How to prevent required field validation in validation function? Issue: When create a node and node publish check box is checked, all validation should work (it's working fine). but when create a node and node publish check box is not checked , then all validation should skip. 

function mymodule_form_alter(&amp;$form, &amp;$form_state) {
   array_unshift($form['#validate'], 'mymodule_reqursive_unrequired');  
}

function mymodule_reqursive_unrequired(&amp;$form, &amp;$form_state) {
    // print_r($form);die;
    $form['actions_copy']['submit']['#limit_validation_errors'] = array();
    $form['actions']['submit']['#limit_validation_errors'] = array();

    $form['title']['#required'] = FALSE;
    $blog_images = $form['field_image_blog'][LANGUAGE_NONE];
    $form['field_page_title'][LANGUAGE_NONE][0]['#required'] = FALSE;
    foreach($blog_images as $image_k =&gt; $blog_image) {
      $form['field_image_blog'][LANGUAGE_NONE][$image_k]['#required'] = FALSE;
    }
    // print_r($form);die;
}


Any suggestion ?
After a lot of debugging and search i get the solution.

function mymodule_reqursive_unrequired(&amp;$form, &amp;$form_state) {
    // print_r($form);die;
   if(!$form_state['values']['status']) {
     drupal_static('form_set_error', NULL, TRUE);
     drupal_get_messages();
   }  
    // print_r($form);die;
}


for reference check it