Duane Blake

Front end developer

How to remove author sitemaps from WordPress

In the WordPress 5.5 release they have added the ability to generate a XML sitemap. XML sitemap are great because it tell search engines such as Google and Bing what pages to crawl. One of the sitemap which the WordPress core creates is a user sitemap. On a WordPress site I work on we didn’t want to use this feature, so I’m going to go through the process how to disable the sitemap.

How to remove author sitemap from WordPress

The way in which I can do this is a placing the following code below into your functions.php

function remove_author_category_pages_from_sitemap($provider, $name)
    if ('users' === $name) {
        return false;
    return $provider;

add_filter('wp_sitemaps_add_provider', 'remove_author_category_pages_from_sitemap', 10, 2);

What the code does is creates a function called remove_author_category_pages_from_sitemap with two arguments $provider and $name. If the name of the sitemap is users the function return false. Otherwise if it’s not a user sitemap it will build the xml file as usual.

We then create a add_filter hook on wp_sitemaps_add_provider then add the function we just created. Finally we give the sitemap a priority of 10 and tell the hook to accept 2 arguments.

As you can see from the code above it’s very easy to remove user sitemaps from your WordPress site.


  1. Mister Dif says:

    This works beautifully. Can’t understand why this was implemented since it creates less secure websites by giving away the admin login. Thanks so much for posting this.

  2. Mister Dif says:

    Works perfectly. Love not having to add the Yoast plugin to do this. Thank you for this!

  3. Noo says:

    thanks dude i was looking for this.

Leave a comment

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