How to Reduce Yoast SEO Sitemap Entries

For very large websites, Yoast SEO may become a minor performance hindrance. When you are running a website with thousands of pages, then large sitemap’s can become a problem.

Typically, Yoast SEO does a very good job of caching sitemaps to reduce database query time. However, for large sites on limited hosting, it can lead to time out errors or the sitemaps failing to generate in the first place.

Now, back in the day, Yoast SEO had an option to limit the number of entries from within the plugin. This feature has since been removed. The good news is there is an easy way to limit entries via a filter!

When Would I Want To Do This?

There are legitimate reasons to do this. For example, if you have a website with a lot of content but you are on a shared hosting plan where resources are scarce. Or if your host just sucks, you can run into situations where your sitemaps might spit out a blank white screen. If you want some recommendations on a good host, check out this post.

The reason for this is likely due to the sitemap failing to cache because the process is timing out. The best solution would be to get a better host, but if that is not an option, the below code should resolve the issue.

Here Is The Code

/* Sets limit to 100 per sitemap */
function sert_max_entries_per_sitemap() {
    return 100;
add_filter( 'wpseo_sitemap_entries_per_page', 'sert_max_entries_per_sitemap' );

The above code will reduce the default number of entries from 1,000 to 100. There is no difference from an SEO perspective and for the average use case.

scott hartley

About the author

Scott is a web performance geek, lover of all things coffee, and avid video game player. His WordPress work delves into web performance, web security, and SEO.

1 thought on “How to Reduce Yoast SEO Sitemap Entries”

Leave a Comment