Change the Number of URLs per Sitemap Page
Changes how many links each page of the built-in XML sitemap holds (2,000 by default), for example to split a huge sitemap into smaller files.
Opens WPIDE on
Code
// Number of URLs per sitemap page.
$wpide_sitemap_max_urls = 500;
add_filter( 'wp_sitemaps_max_urls', function () use ( $wpide_sitemap_max_urls ) {
return max( 1, min( 50000, (int) $wpide_sitemap_max_urls ) );
} );
Notes
Values between 100 and 50,000 are allowed by the sitemap protocol.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.