Yoast SEO sitemaps on large wordpress site
Written by Yujin Boby
Edit in WordPresswhen using Yoast SEO plguin on large wordpress site, sitemap can fail to generate.
To fix this, you can allow more memory for sitemap pages, for this add following code in your wp-config.php file.
if (isset( $_SERVER['REQUEST_URI']) && preg_match('/sitemap.*xml/i', $_SERVER['REQUEST_URI'])) {
define('WP_MEMORY_LIMIT', '4096M');
}
Another option is to limit number of urls per sitemap file. To limit 200 urls per sitemap file, add follwing code to your themes functions.php file
function my_max_entries_per_sitemap() {
return 200;
}
add_filter( 'wpseo_sitemap_entries_per_page', 'my_max_entries_per_sitemap' );
Back to WordPress
