Support

Account

Home Forums General Issues Use Date/Time picker as post publication date Reply To: Use Date/Time picker as post publication date

  • Since it is being saved as draft, do you have a pre_save_post filter that is doing this? If so, the I would change the post date there. Otherwise, you should do some testing here to make sure that you’re updating the right post since this will run on every post that’s saved.

    More than likely the reason the post date is not being updated is that the value returned by ACF is not a valid date that can be inserted. What is the return format for the date field. It should be ‘Y-m-d H:i:s’. I don’t see anything else in your code that would cause the date not to be updated. You can check this by

    
    $post = wp_update_post( $my_post );
    if (is_wp_error($post)) {
      echo 'WP ERROR: <pre>'; print_r($wp_error); echo '</pre>'; die;
    }