Inserted Wordpress Post Shows Bad Date In RSS Feed

故事扮演 提交于 2019-12-13 02:23:13

问题


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:

<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!


回答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.



来源:https://stackoverflow.com/questions/14897905/inserted-wordpress-post-shows-bad-date-in-rss-feed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!