WordPress Fix for Schedule Missed Posts

After upgrading successfully to WordPress 2.9 the other day, I was mortified to find that all of a sudden all of my scheduled posts were being missed one after the other, and the only solution to actually force publish them was to hit the Quick Edit option on the posts listing page and change the each post’s status to published.

Needless to say, this is rather unacceptable.

Thankfully though, there is a fix for this particular problem, one that doesn’t involve installing a new plugin but rather depends on you editing one of WordPress’ internal files.

Now if we ignore the fact that your web host has suddenly and inexplicably gone and disabled your WordPress cron, we can assume that the problem lies in the cron (or scheduled task if you are from the Windows world) itself. As you might have noticed, WordPress seems to be getting slower and slower with each release, which is pretty natural when you think about just how much extra bells and whistles the developers keep having to throw at it in order to keep the ravenous horde that are its followers happy.

However, this could be exactly where the problem lies. If you go and locate the WordPress internal file /wp-includes/cron.php, opening it up and running a search for wp_remote_post should bring up a line looking something like this:

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

(Hint: it’s around line 229 in a standard WordPress 2.9 config file)

If you look closely at the function call being carried out, you’ll notice that a timeout value of 0.01 seconds is being passed to the function, which is coincidentally exactly where the problem lies – the remote post is being adjudged to have timed out and thus aborted before it could actually run its job properly!

So the solution?

Well it is a simply matter of increasing that relatively small number of 0.01 to something more generous, like 20 seconds for example, meaning that the updated string should now look like this:

wp_remote_post( $cron_url, array(‘timeout’ => 20, ‘blocking’ => false, ‘sslverify’ => apply_filters(‘https_local_ssl_verify’, true)) );

Obviously you then need to save your changes and upload the saved file back to the server in order for it to be activated.

You might also enjoy:

  • Do you make use of the nifty little trash feature recently introduced in WordPress 2.9 that allows you to "delete" or "trash" posts to a recycle bin from wh ...
  • At least the guys at WordPress haven't been sitting back and doing nothing about the horrible host of bugs they introduced with their latest WordPress 2.9 u ...
  • I see the guys at WordPress sneaked 2.9.1 live this morning, with this quickfire release attending to a number of annoying glitches and bugs brought in by t ...
  • Random posts are always fun to throw up onto your blog, as they help encourage readers stick around for that little bit longer and explore the otherwise dee ...
  • Now that I've moved all my blogging onto the WordPress platform, I have to begrudgingly admit to it being pretty damn cool after all. However, there are a f ...

About Craig Lotter

Craig Lotter is an established web developer and application programmer, with strong creative urges (which keep bursting out at the most inopportune moments) and a seemingly insatiable need to love all things animated. Living in the beautiful coastal town of Gordon's Bay in South Africa, he games, develops, takes in animated fare, trains under the Funakoshi karate style and for the most part, simply enjoys life with his amazing wife and daughter. Oh, and he draws ever now and then too.
This entry was posted in Software & Websites, Technology & Code, Tutorials and tagged , , , , , . Bookmark the permalink.
  • http://www.domoticpoint.com Fabrizio

    Hi there! Did you hear of the same problem (missed schedules + trackback not working) in 2.9.2?
    I have this problem on 2 websites… and it's driving me nut! Thanks!

blog comments powered by Disqus