Inserted WordPress Post Shows Bad Date In RSS Feed

Our wordpress blog (currently version 3.4.2) has an external process that inserts posts directly into the database from a third party. I don’t have the ability to change that, so don’t bother telling me it shouldn’t be done that way. I CAN change the insert statements though.

The posts show up and everything looks fine except that the RSS feed shows an invalid year (expecting 2013, instead getting -0001) in the date field:

Read More
<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>

The post_date field in the wp_posts table for the post shows the correct date, and on the site the post has the right date. It shows up in the right place chronologically.

If I manually edit the post using the control panel and change the date even by just one second and re-publish the post then it fixes the feed.

This problem causes the RSS feed to not validate, and it’s breaking other things. Help!

Related posts

Leave a Reply

1 comment

  1. There are 4 dates stored for each WP post: Post_date, post_date_gmt, post_modified and post_modified_gmt.

    I recommend you to insert the same date for both post_date and post_modified and see if it works.