Remove Categories, Post Tags and Authors from wp-sitemap.xml

Skip to the code.

I love the sitemap functionality added to WordPress back in version 5.5. Anytime I can dodge using a plugin, I prefer to do so. Plugins are great, at times, but they also open your site up to a plethora of potential issues.

Think about it. Anytime a plugin is developed by someone outside of the WordPress crew, it is completely up to that developer to maintain the code properly. We’re all humans, and we make mistakes. When we don’t have a team of experts and testers checking our work, things are bound to go wrong. So, fewer plugins equals fewer headaches.

As of WP 5.5, every website has a sitemap. Just go to (ironically, perhaps, this website does use a plugin, so that URL scheme won’t work here.) If you use an SEO plugin, or a sitemap-specific plugin, those may overwrite that file and redirect you somewhere. But if you don’t, the built-in sitemap should show up. Here’s one for a pretty new, basic site I’m working on for a kids indoor playground coming to Frederick, Maryland:

screenshot of default wordpress sitemap

However, if your website is relatively simple, you may not need everything that’s built into the default wp-sitemap.xml. For example, you may only have one user, so do you really need this wp-sitemap-users-1.xml file?

screenshot of the users wp-sitemap.xml page

And you may not utilize categories and/or tags, or maybe you just don’t want some custom taxonomy or post type showing up.

Let’s look at how to remove these with a little functions.php code.

// This removes the authors part of the sitemap
add_filter( 'wp_sitemaps_add_provider', function ($provider, $name) {
return ( $name == 'users' ) ? false : $provider;
}, 10, 2);

// Here's how we can remove categories, post tags and custom taxonomies
function( $taxonomies ) {
unset( $taxonomies['category'] );
unset( $taxonomies['post_tag'] );
unset( $taxonomies['my_custom_taxonomy_slug'] );
return $taxonomies;

// Here's how we can remove post types
function cn_remove_post_type_from_sitemap( $post_types ) {
unset( $post_types['post'] ); // CAUTION! You probably don't actually want this, it would remove all of your blog posts
unset( $post_types['page'] ); // CAUTION! Same as above
unset( $post_types['my_custom_post_type_slug'] ); // Removes a custom post type, which you may want to do
return $post_types;
add_filter( 'wp_sitemaps_post_types', 'remove_post_type_from_wp_sitemap' );

That’ll do it!

Don’t forget to submit your sitemap to Google, too.

Up Next: Fix 404 Error with All in One SEO Sitemaps