Make WordPress Core

Ticket #50571: 50571.diff

File 50571.diff, 627 bytes (added by elrae, 4 years ago)

sets minimum pages to 1 on pages

  • wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php

     
    172172
    173173                $query = new WP_Query( $args );
    174174
    175                 return isset( $query->max_num_pages ) ? $query->max_num_pages : 1;
     175                $min_num_pages =  ( 'page' === $post_type && 'posts' === get_option( 'show_on_front' ) ) ? 1 : 0;
     176                return isset( $query->max_num_pages ) ? max( $min_num_pages, $query->max_num_pages ) : 1;
    176177        }
    177178
    178179        /**