Skip to content

Commit

Permalink
Add suggested post_date > 0 fix to resolve #171
Browse files Browse the repository at this point in the history
  • Loading branch information
mchanDev committed Aug 18, 2023
1 parent a471648 commit c8c1efe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion msm-sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public static function disable_canonical_redirects_for_sitemap_xml( $redirect_ur
public static function get_post_year_range() {
global $wpdb;

$oldest_post_date_year = $wpdb->get_var( "SELECT DISTINCT YEAR(post_date) as year FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY year ASC LIMIT 1" );
$oldest_post_date_year = $wpdb->get_var( "SELECT DISTINCT YEAR(post_date) as year FROM $wpdb->posts WHERE post_status = 'publish' AND post_date > 0 ORDER BY year ASC LIMIT 1" );

if ( null !== $oldest_post_date_year ) {
$current_year = date( 'Y' );
Expand Down

0 comments on commit c8c1efe

Please sign in to comment.