WordPress Ate My Posting Date

Send to Kindle

This post is really a test, but I’ll share the full problem and solution (assuming the test works), so it might help someone else out there as well. 🙂

The other day, for the first time ever, I noticed that a post of mine hit my RSS reader (Thunderbird) with a date of 11/29/1999.  I was busy with other things and decided to come back to it. Of course, I didn’t…

The next time I posted, the date was correct again. I (foolishly) assumed that the problem was transient (and possibly corrected). A few more good posts, then yesterday, back-to-back bad posts. I realized exactly what was different between the good posts and the bad ones. At least procrastinating paid off this time. 🙂

All of my good posts were made with Windows Live Writer locally on my laptop and then saved to the server as a draft for continued editing. All of my bad posts were started and finished directly in the web interface of WordPress 2.5.1.

This certainly wasn’t a native 2.5.1 problem, because I’ve been running 2.5.1 a lot longer than my first bad RSS pull and until reasonably recently, I posted 100% of the time through the web interface. I selected the last few rows from the wp_posts table and spotted the problem instantly.

The post_date_gmt had the following value in my three bad posts: 0000-00-00. A Google search revealed this forum thread discussing the problem. Some people seemed to think it was related to the installation of XCache (others thought that you also needed a separate plugin installed to provoke the problem). Since I recently installed XCache (as reported in my NginX post), I was more than willing to believe that this was my problem. Of course, I didn’t see how it worked when Windows Live Writer was posting, but it was certainly possible that it took a different code path…

There was a pointer to a patch in that thread. The person who posted the link also commented that he thought this was not the “right” fix, though he said it worked. I’m not sure why he felt that way. Aside from being innocuous (meaning, there was no way that this could hurt anything), it seemed like a reasonable fix and was already in the trunk for WordPress 2.5.2, so it also seemed safe to apply, given that it would soon be production WordPress anyway.

So, I downloaded and applied the patch. I won’t know until I click on Publish whether it will work, as the post_date_gmt column correctly remains at 0000-00-00 while I’m in Draft mode. If it works, I won’t update this post. If it fails, I’ll come back and add another paragraph to let you know it didn’t work…

Update: I decided to add this bit quickly. It worked (so that’s not why I’m back here). I thought of one more possibility for the cause, which has nothing to do with XCache. Recently, I noticed that my posting times were in EST, not EDT (meaning, the one hour time-zone change didn’t happen automatically). I went into the WP Admin interface and adjusted the setting to be GMT-4 instead of GMT-5. It’s possible that this change caused the problem as well, but I really have no idea…