Make WordPress Core


Ignore:
Timestamp:
07/21/2020 01:55:45 PM (4 years ago)
Author:
swissspidy
Message:

Sitemaps: Correctly enforce maximum number of sitemaps in index.

Before this change, the limit of 50k entries was enforced for the number of providers, not the amount of sitemaps all providers add to the index in total.

Props pbiron, swissspidy.
Fixes #50666.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php

    r48098 r48532  
    2424     */
    2525    private $sitemaps = array();
    26 
    27     /**
    28      * Maximum number of sitemaps to include in an index.
    29      *
    30      * @sincee 5.5.0
    31      *
    32      * @var int Maximum number of sitemaps.
    33      */
    34     private $max_sitemaps = 50000;
    3526
    3627    /**
     
    7061
    7162    /**
    72      * Lists all registered sitemaps.
     63     * Returns all registered sitemap providers.
    7364     *
    7465     * @since 5.5.0
     
    7768     */
    7869    public function get_sitemaps() {
    79         $total_sitemaps = count( $this->sitemaps );
    80 
    81         if ( $total_sitemaps > $this->max_sitemaps ) {
    82             return array_slice( $this->sitemaps, 0, $this->max_sitemaps, true );
    83         }
    84 
    8570        return $this->sitemaps;
    8671    }
Note: See TracChangeset for help on using the changeset viewer.