I'm working on a custom event scheduler for my website that allows people to easily go in and set the article to post in the future. The reason I'm overriding the normal Wordpress functionality is because I wanted to make it super easy to choose the date, since the sermons should only be posted on a Sunday. So I have a custom dropdown calendar that only allows you to select the Sunday's of a month.

Anyways my problem is that all my posts give an error of "Missed Schedule" in the admin panel. I'm able to get around this by using the "post_status" => "future" to list posts on the page, but this is kinda "hacky"...

Why would this code be giving me that "Missed Schedule" error?

function cfc_reset_sermondate( $data ) {

if($data['post_type'] == 'sermon_post') {
    if($_POST['cfc_sermon_date']) {
        $date = $_POST['cfc_sermon_date'];
       // $date = DateTime::createFromFormat('D - M j, Y', $date);
       // $date = $date->format('Y-m-d');
        $date = createFromFormat($date);

        $postDate = strtotime($date);

        $data['post_date'] = $date;

        $todaysDate = strtotime( date( 'Y-m-d' ) );
        if ( $postDate > $todaysDate ) {
            $data['post_status'] = 'future';
return $data;

add_filter( 'wp_insert_post_data', 'cfc_reset_sermondate', '99', 1);

Here's the createFromFormat function:

function createFromFormat($date_ugly) {
   $schedule = 'Sunday - Sep 15, 2000';
    // %Y, %m and %d correspond to date()'s Y m and d.
    // %I corresponds to H, %M to i and %p to a
    $ugly = strptime($date_ugly, '%A - %b %e, %Y');
    $ymd = sprintf(
        // This is a format string that takes six total decimal
        // arguments, then left-pads them with zeros to either
        // 4 or 2 characters, as needed
        $ugly['tm_year'] + 1900,  // This will be "111", so we need to add 1900.
        $ugly['tm_mon'] + 1,      // This will be the month minus one, so we add one.
    $new_schedule = new DateTime($ymd);
    return $new_schedule->format('Y-m-d');

Custom Date Calendar

Missed Schedule Error

  • Any reason why you are not simply using the publish date and setting that to a future date? Apr 27, 2012 at 16:16
  • are you talking about $data['publish_date'] = 'the post date in the future'? I didn't know this existed... Hmmm... would that automatically set the post_status to 'future' if it was a date in the future?
    – Caleb
    Apr 27, 2012 at 16:21
  • Or are you talking about why am I using a custom date picker instead of just the standard Scheduler? I'm using the custom calendar dropdown because I need to restrict the post dates to only Sundays.
    – Caleb
    Apr 27, 2012 at 16:22

1 Answer 1


WordPress has this functionality: by setting the publication date to the future in the WordPress 'publish' box, the post will be given 'future' status and will be scheduled to publish for that date.

My guess is that the problem arises because you haven't set the GMT time - which is what the WordPress uses to schedule the publications. Or otherwise you've hooked in after the scheduling has been done.

The 'easy' way (but leaves you with two 'publish date meatboxes' - which from a UI point of view is not great).

Keep in mind that WP expects the date in the Y-m-d H:i:s format

add_action('save_post', 'wpse50448_schedule_sermon');

function wpse50448_schedule_sermon($post_id) {

    //Perform checks, nonces etc

    $date='';//set date
    $date_gmt='';//set date in GMT (UTC)

    // unhook this function so it doesn't loop infinitely
    remove_action('save_post', 'wpse50448_schedule_sermon');

    // update the post, which calls save_post again
    wp_update_post(array('ID' => $post_id, 'post_date' => $date,'post_date_gmt' => $date_gmt));

    // re-hook this function
    add_action('save_post', 'wpse50448_schedule_sermon');

This should work, but is not tested!


Alternatively you can de-regester the publish metabox, and re-register it with exactly the same mark-up (but with some ID tags changed so WP's javascript ignores it, and then apply your own javascript to it). From a UI point of view this much better, but a bit more involved.

The first part is outlined in this post for another metabox.

  • Thanks for your help. I'll have to try implementing this solution.
    – Caleb
    Apr 27, 2012 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.