WP timestamp problem fixed

I’ve been having an issue for the last week or two, where articles that I post to the site with ecto (or, more likely, anything that uses the XMLRPC interface) have a correct timestamp, but are going into the “future posts” section.

On further investigation, it turned out that the post_date_gmt was wrong, by a factor that was exactly the same as my TZ offset (i.e., the post was scheduled to go up 6 hours in the future).  I narrowed it down to either a timezone problem on my system, or a problem with wordpress itself.  A lot of digging later, I’ve got the solution.

The getIso function of the IXR_Date class (in wp-includes/class-IXR.php) doesn’t return a timezone.  So to fix the problem, I made the following change:
On line 628, change
return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second;
to this:
return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;

Should clear the problem right up.

Published by

devlogic

I write stuff on this blog. All of the stuff.