Limit the number of sitemap entries – Yoast SEO plugin

/, Tricks or Guides/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.

OR

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+00:00 June 7th, 2018|Tips, Tricks or Guides|0 Comments