I fixed News Sitemap bug
-
The News sitemap plugin shows the wrong times and dates. It gets the gmt time, shows the timezone offset, but doesn’t adjust the time by that offset. So Google News shows all of our stories with a 4-hour offset.
Here is the fix:
File: wpseo-news/classes/class-sitemap.php
Function: private function get_publication_date( $item )
I moved the Fallback #3 code to the top, because that is the code that should be at the top, not the GMT time.private function get_publication_date( $item ) { if ( $this->is_valid_datetime( $item->post_date ) ) { // Fallback 3: post_date return $this->format_date_with_timezone( $item->post_date ); } if ( $this->is_valid_datetime( $item->post_date_gmt ) ) { // Create a DateTime object date in the correct timezone return $this->format_date_with_timezone( $item->post_date_gmt ); } if ( $this->is_valid_datetime( $item->post_modified_gmt ) ) { // Fallback 1: post_modified_gmt return $this->format_date_with_timezone( $item->post_modified_gmt ); } if ( $this->is_valid_datetime( $item->post_modified ) ) { // Fallback 2: post_modified return $this->format_date_with_timezone( $item->post_modified ); } return ''; }
- The topic ‘I fixed News Sitemap bug’ is closed to new replies.