• Resolved processi

    (@processi)


    Hello

    Our Google search console has flagged warnings against some of the sitemap url’s, the message reads:

    An invalid date was found. Please fix the date or formatting before resubmitting.

    I’m assuming it relates to the dates on the sitemap beginning with -001-
    you can see examples on line 9-10 here:
    https://www.processindustryinformer.com/sitemap_index.xml

    Any ideas how we can fix this?

    Many thanks

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Sa?a

    (@stodorovic)

    Hi @processi

    There are similar issues. I was trying to figure out more details. It seems that there are posts where post_modified is 0000-00-00 00:00:00, but in this case post_modified_gmt could be negative (or something like this).

    If you have experience related to PHP code, you can try to modify query in class-post-type-sitemap-provider.php – https://github.com/Yoast/wordpress-seo/blob/trunk/inc/sitemaps/class-post-type-sitemap-provider.php#L145-L153. Try to replace it with:

    $sql       = "
    SELECT post_modified_gmt
        FROM ( SELECT @rownum:=0 ) init 
        JOIN {$wpdb->posts} USE INDEX( type_status_date )
        WHERE post_status IN ( 'publish', 'inherit' )
          AND post_type = %s
          AND post_modified_gmt > '0000-00-00 00:00:00'          
          AND ( @rownum:=@rownum+1 ) %% %d = 0
        ORDER BY post_modified_gmt ASC
    ";
    

    If you can, please try also AND post_date != '0000-00-00 00:00:00' instead AND post_modified_gmt > '0000-00-00 00:00:00'.
    If it helps, I’ll try to do more tests and open new issue on github.

    Regards,
    Sasa

    Thread Starter processi

    (@processi)

    Hi Sasa

    Many thanks for your detailed reply.

    We have tried all the above and disabled our cache plugin, but still not joy ??

    Any other suggestions?

    Thread Starter processi

    (@processi)

    Hi Sasa
    Good news! We disabled and then enabled the plugin and the strange dates have now gone, however there are now some with missing dates altogether!
    Do you know how we can fix this!?

    • This reply was modified 7 years, 2 months ago by processi.
    Sa?a

    (@stodorovic)

    I forgot to write that Yoast SEO uses transients for caching. So, each change in the code requires disable/enable sitemaps or deleting transients.

    Probably, you have some posts which have some weird fields or something like this. I can’t say more details. I see an inconsistency in the code and I’ll try to create new issue on github.

    It’s helpful if we can establish contact via email or chat, then we can together figure out how to fix this.

    Regards,
    Sasa

    • This reply was modified 7 years, 2 months ago by Sa?a.

    Hi,

    ?This is the result of an invalid timestamp in your database, related to the sitemaps listed. We ask that you try the following actions:
    ?
    ?A. Confirm that the time in your database matches the expected time on those links. You may need to speak with your host provider.

    B. It may also be related to caching. Does clearing your caching from your plugin, theme, server, browser, or CDN such as Cloudflare resolve the issue? If you are not sure how to clear your server caching, please speak with your host provider.

    ??This guide explains more: https://kb.yoast.com/kb/missing-or-invalid-date-in-xml-sitemap/

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    Closed due to inactivity

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sitemap date error: Displaying -001-11-30 00:00 +00:00’ is closed to new replies.