Support

Account

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

  • I put this code in my functions file:

    add_action('acf/save_post', 'test_update_post_date_from_acf', 20);
    function test_update_post_date_from_acf($post_id) {
    	// remove this filter to prevent potential infinite loop
    	remove_filter('acf/save_post', 'test_update_post_date_from_acf', 20);
    	// date format must be "Y-m-d H:i:s"
    	$post_date = get_field('email_scheduled_date');
    	$post = wp_update_post(array(
    		'ID' => $post_id,
    		'post_date' => $post_date));
    }

    And I made sure that my datepicker return format is set to: Y-m-d H:i:s