Hi Adam! How are you?
Indeed, the changes that I made solved the issue. Now my google news page display the correct publish times, aligned with the publish times that appear in my google news preview, and also with my correct post publish times.
Answering to your questions, now the discrepancy is really gone, and I don’t have any schema types set in the types builder.
I’ll describe briefly the problem and the changes that I made, so other people that have the same problem may find it.
My website has as timezone UTC -3, as we are in America/S?o Paulo (Brazil) timezone. When I subscribed my website for Google News, I noticed that my preview showed the correct publish time for the news retrieved, but my live publication doesn’t. It showed a 4-hours offset, so even an instanly fetched post appeared published as “4 hours ago”.
In my investigations, I tried changing the timezone either in my server, in my PHP environment, and in my wordpress configs, with no success in any of the attempts. Finally, when I narrowed my research, I ended up between 2 potential sources of the issue – GN Publisher (a plugin to generate Google News specific feeds) and Smartcrawl, that generates my post metatags, schema and news sitemaps.
After more research, we assumed GN Publisher was generating the feeds with the correct timezone, so focusing in smartcrawl, I digged and found two places that set the datetime markups for my posts, it was in the metatags (article:published time property) and in the schema (datePublished and dateModified properties).
I noticed that smartcrawl was generating my publish times with the PHP date format “Y-m-d\TH:i:s”, having as output a “YYYY-MM-DDTHH:MM:ss” formatted datetime. This output was set this way both in my metatag as in my shema output. However, in the Google News best practices manual, they point out that datetime must be in ISO8601 format. In the PHP documentation, ISO8601 format should be “Y-m-d\TH:i:sO”, but this gave me an output of “YYYY-MM-DDTHH:MM:ss-0300”, and after testing, it didn’t solve my issue. So I manually changed the format to “Y-m-d\TH:i:sP” in the plugin files and this returned “YYYY-MM-DDTHH:MM:ss-03:00”. Finally, after doing this, the problem was gone and Google News now recognized my posts at the correct times they were being published.
Today I noticed something that may be relevant: My website is using PHP 8.2.8, and as we can see here: https://freeimage.host/i/HQVdaaf, it looks like the “P” in the date format is something from PHP version 8 on. This could explain why my website https://fup.org.br, which I told about in the beginning of this thread, doesn’t have this problem, as it uses exactly the same plugins but uses PHP 7.4.
The files that I changed were “wp-content/plugins/smartcrawl-seo/includes/core/schema/fragments/class-post.php” in lines 62 and 63 (for the datePublished and dateModified schema markups) and “wp-content/plugins/smartcrawl-seo/includes/core/entities/class-post.php” in line 683 (for the article:published_time metatag).
If anyone has the same problem as me, I hope this explanation helps to point out some starting point for research, er even the complete solution =).
Adam, I also hope that this can help you guys at WPMU Dev somehow track and reproduce this issue, if possible, and apply a solution! I’m also available to give any other information needed. Thank you guys for the support!