# 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.

- Type: PHP
- Runs: Run everywhere
- Category: [SEO](https://wpide.com/library/category/seo/)
- Tags: sitemap, xml, limits
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/sitemap-urls-per-page/

## Code

```php
// 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 use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Change the Number of URLs per Sitemap Page" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
