Support » Plugin: Better WordPress Google XML Sitemaps (support Sitemap Index, Multi-site and Google News) » Post modified date,time doesn't match scheduled time

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Khang Minh


    Can you post a link to your website and point out which items are having wrong date?

    see the top post was published(as scheduled) at 2nd april 2013, 00:45 hrs GMT
    but it was written(last modified) at 9:52 GMT on 1st april and xml sitemap doesnt show published/scheduled time

    Plugin Author Khang Minh


    Currently the plugin uses the post_modified field in the database. I believe this field doesn’t get updated when a post is published on a schedule, that’s why it’s showing “9:52 GMT on 1st april” (the last time at which you updated the post).

    Unless the time span between updating and publishing is long, I don’t see an issue. You can manually update the post to change the post_modified field, or add a filter to update post_modified field automatically when the post is published.

    i write once in a month and schedule posts to be published two or three per week.
    So, the time difference will be a lot if i schedule now and its published next month.
    Manually updating makes the idea of scheduling the posts go useless.
    Is there any way i can make this use ‘post_published’ field in database instead of post_modified field ?

    or how to add a filter to update post_modified field automatially

    Plugin Author Khang Minh


    This might help:

    Yours should be draft_to_publish. Your action could be something like (untested):

    function your_callback($post) {
    	if ('post' == $post['post_type']) {
    add_action( 'draft_to_publish', 'your_callback' );

    i mean where to add the filter (which file?)

    i added it in theme’s functions.php but still sitemap shows modified time, not scheduled time

    Plugin Author Khang Minh


    The filter will only work on newly published posts, other posts that are already published need to be manually updated.

    okay it didn’t work for newly published post.
    if you look at the sitemap i linked above, out of the 2 posts published on 1st april, top one was actually scheduled to be published today (and it was published few hrs back).
    But it was written (last modified) on 1st april and now sitemap shows that date but not published date

    Plugin Author Khang Minh


    Perhaps we should use a different approach:

    Better WordPress Google XML Sitemaps

    Just copy post.php in the default module folder to your module folder and edit that file as below:

    – Look for:

    $data['lastmod'] = $this->format_lastmod(strtotime($post->post_modified));

    – Change it to:

    $data['lastmod'] = $this->format_lastmod(strtotime($post->post_date));

    and it should be working (for all posts).

    Thanks.. this worked.
    May be if it takes whichever date is latest by comparing post_modified (VS) post_date , it would make better sitemap.xml
    (just a thought, may be useful for future updates of this plugin)

    well.. actually the approach you suggested is the best.
    if a post is modified, it just moves to the top of sitemap, may be requesting a revisit by bot, but its original published time is shows as modified time, which helps the link to given more priority (if similar content links or copied pages are elsewhere with later dates)

    Plugin Author Khang Minh


    I’m quite confused, so which approach do you prefer?

    actually the one you suggested is best.
    $data[‘lastmod’] = $this->format_lastmod(strtotime($post->post_date));
    that line does what is necessary.
    ignore my other post

    i’ve on more issue. In this sitemap, 2nd link is latest published post on 8th april.
    But and its 4 sitemaps show last modified date as 6th april

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Post modified date,time doesn't match scheduled time’ is closed to new replies.