WordPress.org

Ready to get started?Download WordPress

Forums

Better WordPress Google XML Sitemaps (with sitemapindex, multi-site and Google News sitemap support)
[resolved] Post modified date,time doesn't match scheduled time (21 posts)

  1. Astrogle
    Member
    Posted 1 year ago #

    I've written few posts last week and scheduled them to be published each in 3 days gap.
    When they're published, posts show scheduled time but sitemap's post.xml shows last week's date for each of them.
    Won't this effect ?
    A bot might ignore my sitemap this week as last modified time is shown to be last week's ?

    http://wordpress.org/extend/plugins/bwp-google-xml-sitemaps/

  2. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

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

    Thanks.

  3. Astrogle
    Member
    Posted 1 year ago #

    http://www.astrogle.com/post.xml
    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

  4. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. Astrogle
    Member
    Posted 1 year ago #

    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

  6. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

    This might help:

    http://codex.wordpress.org/Post_Status_Transitions

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

    function your_callback($post) {
    	if ('post' == $post['post_type']) {
    		wp_update_post($post);
    	}
    }
    add_action( 'draft_to_publish', 'your_callback' );
  7. Astrogle
    Member
    Posted 1 year ago #

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

  8. Astrogle
    Member
    Posted 1 year ago #

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

  9. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

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

  10. Astrogle
    Member
    Posted 1 year ago #

    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

  11. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

    Perhaps we should use a different approach:

    http://betterwp.net/wordpress-plugins/google-xml-sitemaps/#module_api

    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).

  12. Astrogle
    Member
    Posted 1 year ago #

    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)

  13. Astrogle
    Member
    Posted 1 year ago #

    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)

  14. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

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

  15. Astrogle
    Member
    Posted 1 year ago #

    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

  16. Astrogle
    Member
    Posted 1 year ago #

    i've on more issue.
    http://www.astrogle.com/post.xml In this sitemap, 2nd link is latest published post on 8th april.
    But http://www.astrogle.com/sitemapindex.xml and its 4 sitemaps show last modified date as 6th april

  17. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

    Ah yes, the sitemapindex also uses post_modified instead of post_date. You can basically do the same thing, copy sitemapindex.php from the default module folder to yours and try to use post_date instead.

  18. Astrogle
    Member
    Posted 1 year ago #

    Sub-module file: taxonomy_category.php is not available in both default and custom module directory. The plugin will now try loading the parent module instead.

    this is the error i see now and http://www.astrogle.com/taxonomy_category.xml have dates of 1969 !!!!

    and even after editing sitemapindex.php date doesnt change
    i flushed the cache and checked again.

    even http://www.astrogle.com/taxonomy_post_tag.xml have 1969 date.

  19. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

    Something is not right about your categories? Are you setting them up normally? Is there any plugin you using that can affect categories?

  20. Astrogle
    Member
    Posted 1 year ago #

    none.. i haven't changed anything in admin dashboard since long time.
    suddenly noticed error messages in google webmastertools dashboard yesterday about this date

    using same plugin with same site settings on another sites but they're okay

  21. Khang Minh
    Member
    Plugin Author

    Posted 1 year ago #

    Even the URLs are incorrect. If possible please contact me directly using this page: http://betterwp.net/contact/ with a temporary admin account so I can debug.

    Thank you.

Topic Closed

This topic has been closed to new replies.