RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

WordPress Post Missed Schedule

This code was required some time back when one of our sites failed to publish as scheduled. Instead, in the WP control panel, I was met with a message that said "Missed Schedule".

WordPress Post Missed Schedule

Since the error wasn't caused by an upgrade or modification, and given that it's happening with regularity, it suggests a modification or error server-side, but I can't be sure. It seems to be more commonly associated with version 2.9 (with a supposed 'fix' in 2.9.1), but I'm still getting it in version 3.0.

This error is quite old and it's unlikely the error will continue to cause issues with your installation.

After a little investigation, it turns out that future posts are assigned a cronjob via the WP function wp_schedule_single_event - a somewhat unusual means of accomplishing the task. Far be it from me to question the excellent gurus at WordPress - I'm sure they have their reasons, but one would think a more effective means would be to simply check the database for scheduled posts... and then publish them.

Rather than try and build my own workaround, I found this excellent little plugin at Wordpress.org . As per the author's description, it will "Schedule a hook which will be executed once by the WordPress actions core at a time which you specify. The action will fire off when someone visits your WP blog if the schedule time has passed."

The hook will disable native cron function and replace it with its own. You can disable the particular line from within the code if it conflicts with other plugins. I've tested it successfully with WordPress versions up until 3.0.

If you're somebody that prefers to modify code, you can alter the cron.php file in the includes directory with the following. It may fix the error if it's caused by a timeout.

Replace this:

1
<?php 
2
$cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron';
3
wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
4
}

With this. We've changed 0.1 to '20'.

1
<?php 
2
$cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron';
3
wp_remote_post( $cron_url, array('timeout' => 20, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
4
}

This isn't recommended because it means that you'll have to modify the code every time there's a new WP release.

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment