Change the Number of Links per Yoast Sitemap
Sets how many URLs each Yoast SEO sitemap page holds. Lower it if large sitemaps time out on your server.
Opens WPIDE on
Code
// URLs per sitemap page.
$wpide_sitemap_per_page = 500;
add_filter( 'wpseo_sitemap_entries_per_page', function () use ( $wpide_sitemap_per_page ) {
return absint( $wpide_sitemap_per_page );
} );
Notes
Yoast's default is 1000; Google accepts up to 50,000.
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.