How to disable wp-sitemap.xml in WordPress

Sitemaps in WordPress 5.5

By default, WordPress 5.5 includes an extensible core sitemap to help search engines find your most important pages. This sitemap can be created for all queryable post types, taxonomies, author archives, and homepage.

WordPress will expose a sitemap index, which can hold up to 50000 sitemaps while a single one can hold a (filterable) at least 2000 entries, at /wp-sitemap.xml. Search engines can easily read this sitemap thanks to the robots.txt file exposed by WordPress.

You can configure sitemaps behavior by following this instruction from the WordPress developer team.

Disable XML Sitemaps Using Code

In case you don’t like using a plugin, you have two options to work with code: quickly disable or totally remove WordPress 5.5 default XML sitemaps.

To quickly disable WordPress 5.5 default XML sitemap, insert the following code to the theme’s functions.php file:

add_filter( 'wp_sitemaps_enabled', '__return_false' );

But that way just hides the XML sitemap and still keeps all the functions. To permanently remove WordPress XML sitemaps functionality completely, insert this code in the functions.php file of your theme:

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

Final Words

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

This version has many other features and I think users will need time to explore and test all of them. If you have any experience with this version or any question about it, feel free to share it with us.

2 responses to “How to disable wp-sitemap.xml in WordPress”

  1. Edi Silva says:

    Reactivate wp-sitemap.xml

    Hello.

    I used the script in my functions.php file to disable the wordpress-generated sitemap (wp-sitemap.xml).

    I just wanted to temporarily disable it, but after I deleted the script from my functions.php file the sitemap didn’t load and generated a 404 error page.

    What do I do to get wp-sitemap.xml back on my site.

    https://www.icloud.com.br/wp-sitemap.xml/

    greetings

  2. amit says:

    Hi Dear,
    Your wp-sitemap.xml is working. Please clear your browser’s cache and check again.
    https://www.icloud.com.br/wp-sitemap.xml

Leave a Reply

Your email address will not be published. Required fields are marked *