Limit the number of sitemap entries – Yoast SEO plugin

Limit the number of sitemap entries – Yoast SEO plugin

Limiting the number of sitemap entries can prevent issues associated with sitemaps that have become too large; like the server exceeding set php memory limits whenever compiling large sitemaps.

Before v7.0, Yoast had a feature available which allowed you to limit sitemap entries. Unfortunately this feature has since been removed, since it was not functionality needed for most standard WordPress installations.

However, Yoast has provided the wpseo_sitemap_entries_per_page filter for exceptional use-cases.

Code Snippet

Paste the below snippet in your theme’s functions.php.

Warning: as a precautionary measure, always back-up the database and theme files before editing the functions.php file.


If you don’t have access to site files, or you don’t feel comfortable editing these files directly, or you cannot back-up these files before doing so, install and activate Code Snippets and add it as a snippet set to “run everywhere”.

Adjust the return value (100) to the number of entries you would like to set the limit at.

By | 2018-06-07T09:59:56+02:00 June 7th, 2018|Tips, Tricks or Guides|0 Comments
Need Assistance? Chat with us

Web SEO is pleased to announce that we have made contingency plans for all of our team members to remain fully operational during the national shutdown announced by the government. All of our team members will have full access to emails during this period and our support services will continue as per normal. (Learn more and stay informed about the COVID-19 national pandemic and how it affects you at