How to Disable the Default WordPress Sitemap

WordPress now comes with a default sitemap included in it’s core. This can confuse site owners as they may have previously used a sitemap generated by plugins such as Yoast SEO. Having two sitemaps can cause a conflict, so today we’ll cover how to disable the default WordPress sitemap.

What is Sitemap.xml?

Typically, search engines use a bot to automatically crawl website data and then index and store it in their database. Whenever users search for some keywords, search engines will find the most relevant and suitable data for these keywords to show up in the SERPs. However, this process is time-consuming, so you need to have a sitemap to tweak it for a better chance of showing your website in the SERPs. Thanks to the sitemap, search engines can “read” your site quickly and easily. It also ensures that all URLs on your website are correctly submitted to search engines.

Default Sitemap in WordPress 6.0+

By default, WordPress 5.5 includes a repeatable central sitemap to help search engines find your most important pages. This sitemap can be created for all searchable post types, taxonomies, author archives, and homepage. WordPress will expose a sitemap index, which can contain up to 50000 sitemaps, while one can only contain (filterable) at least 2000 entries, in /wp-sitemap.xml. Search engines can easily read this sitemap thanks to the robots.txt file exposed by WordPress. You can configure the behavior of sitemaps by following these instructions from the WordPress developer team.

Disable the Default WordPress Sitemap Function

In case you don’t like using a plugin, you have two options for working with code: quickly disable or completely remove the default WordPress 6.0+ XML sitemaps.

To quickly disable WordPress 6.0+’s default XML sitemap, insert the following code into your theme’s functions.php file:

add_filter( 'wp_sitemaps_enabled', '__return_false' );

But that way it only hides the XML sitemap and still keeps all the features.

To permanently remove WordPress XML sitemap functionality, insert this code into your theme’s functions.php file:

add_action( 'init', function() {
  remove_action( 'init', 'wp_sitemaps_get_server' );
}, 5 );

Now you know the quick and easy ways to disable the default XML sitemap in WordPress 6.0+. Depending on your website and your demand, you may decide to keep or remove this feature. For example, if you haven’t added any sitemaps yet, you should keep the default WordPress sitemaps.