WP Post Scheduling Mishap

I recently had to help someone I host a site for solve a very strange issue with post scheduling after an upgrade to 2.9 on his WP site. I’ve hosted many WP sites over the years and have never had this problem personally, so I had to dig around a bit.

The Issue:

When the time allotted for a scheduled post to be published occurs, the post is not published, and a message within the Admin panel only says “Missed Schedule.”

After perusing around the WP forums for a bit, I came to realize that this is a hot topic for many 2.9 early adopters. After looking deeper into the forums, I found that this has been a potential issue with Wordpress versions since the release of 2.7. Some say the “Missed Schedule” mishap can be caused by a temporary “hiccup” with a site’s DNS. As I manage the DNS for the particular site I host, I knew this to not be the case. Further research did indeed provide me with a solution.

The Solution:

Apparently with all the new fancy upgrades to the WP core, a significant amount of time (in the web world this means milliseconds!) has been added to the time it takes to run the job that actually publishes a post. From what I can tell this is due to the number of hooks that data has to be run through to make it from the edit page as a draft, to the front page of your blog as a live post. The addition of running it through the scheduling cron job pushes it too far. Can’t we just extend the allowable time to publish a post you say? Here you go:

The time limit is set around line 230 in the /wp-includes/cron.php file. The default line will appear as such:

230
wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );

As you can see, the limit is set to 0.01 seconds by default. I tried increasing the value in increments, and finally decided on 20 seconds. You may find that this can very from server to server, so play around with it for a bit to optimize it for your setup. So here’s the updates line:

230
wp_remote_post( $cron_url, array('timeout' => 20.0, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );

So there you go! If you’ve found yourself upgrading to a new version of WP and you are unable to successfully publish a scheduled post, try this out!

  • Share/Bookmark

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)