WordPress 2.9 Timezone and Scheduled Posts Missed Fixes

Posted by Adam Pieniazek | Blogging Tips | December 23rd, 2009

On sites running WordPress 2.9, we’ve noticed a small bug appear on a few installations. After the upgrade it appears the timezone settings get misconfigured AND scheduled posts don’t publish on time. If the timezone was manually set (e.g. using UTC +/-), after the upgrade it would reset to a value one lower/higher and on certain server configurations scheduled posts simply wouldn’t publish.

There were a few other bugs, such as Josh Gans’ personal pet peeve, square buttons in the administration panels. The beta for WordPress 2.9.1 is already out but if you can’t wait a day or two, keep reading for fixes to the timezone and scheduled posts bugs.

Timezone Fix

In this blog we’re in the UTC -5 timezone [Eastern Standard Time], but after the upgrade the timezone was listed as UTC -4, throwing off the local time by one hour.

The fix for the timezone is easy, go into Settings –> General –> Timezone and choose a city that’s in the same timezone as you rather than using a manual offset. Yes Bostonians, that means you’ll have to swallow a small bit of pride and choose New York as your timezone.

On some WP 2.9 installs, this quick fix took care of scheduled posts not publishing. On others, we had to take a few extra steps.

Scheduled Posts Missed Fix

Scheduled posts are a great feature of WordPress, allowing you to write articles in advance and set them to publish automatically. Unfortunately, in WordPress 2.9 a small change in the cron code (cron is the process which publishes your posts for you, it’s a part of your Unix based server, not WordPress) causes scheduled posts to fail on some setups.

Important Note: If you’re hosted by The 42nd Estate, you should not experience this bug. If you do, please let us know!

The above timezone fix may also fix your scheduled posts error (it did on this install of wordpress), but if you’re on a very slow shared server or missing certain functions cron.php requires, it may not. If you’re scheduled posts are still not working after re-adjusting the timezones you’ll have to make a minor tweak to a core WordPress file to get scheduled posts working.

In your wp-includes folder, open up cron.php. On line 229 (or around there), you’ll see the below line:

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

Change it to:

$cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron';
        wp_remote_post( $cron_url, array('timeout' => 5, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
</pre>

Basically, we changed the timeout setting to a larger number. From reading through some of the Trac tickets out there, the cause may be due to a slow server, improperly configured server, or a bug in Curl. You can change the 5 to anything above 1, it seems some servers would round .01 down to zero, in effect causing an infinite loop that never got resolved.

WordPress 2.9.1

The awesome WordPress team is already hard at work cranking out version 2.9.1 that’ll fix these issues and a few other errors. If you have a few minutes please download and install the 2.9.1 beta to help the WordPress team debug the latest release and confirm that any issues from 2.9 are resolved.

Tags: , , , , , , ,

6 Responses to “WordPress 2.9 Timezone and Scheduled Posts Missed Fixes”

  1. Yeah the scheduled posts bug is annoying. Thanks for posting a fix! 🙂

  2. Very useful and informative. Bookmarked.

    Thanks for sharing.

  3. Wow I was just trying to figure out a fix for this and found your blog originally on your page rank post but saw this blog on the side. Very useful as I just upgraded to 2.9 and do all of my blogging on Monday with the posts scheduled out. This makes sense now and i’ll put this fix in. Thanks again

  4. Scheduled posts, is great features, but sometimes I get confused, at first I thought that because of the large time difference between me and the server. Not knowing actually a bugs. Thanks for the fix..

  5. Scheduled post feature is a lifesaver especially while working with a large team of writers for a big online blog. Thanks for the fix! Think I’ll upgrade to 3.0 anyways though.

  6. The Fix you provided is excellent.This cheduled posts bug is annoying.
    Thanks for the fix

Recent Posts From The 42nd Estate Network

Recent Posts From The Community