I’ve got WP 5.5 installed and I’m experimenting with the XML sitemap core function.
I am trying to filter out the users link, the last line in the following sitemap:
URL
https://mydomain.com/wp-sitemap-posts-post-1.xml
https://mydomain.com/wp-sitemap-posts-page-1.xml
https://mydomain.com/wp-sitemap-taxonomies-category-1.xml
https://mydomain.com/wp-sitemap-taxonomies-post_tag-1.xml
https://mydomain.com/wp-sitemap-users-1.xml
On the Core Sitemaps plugin page, it says you can “You can use the wp_sitemaps_register_providers filter to disable sitemap generation for posts, users, or taxonomies.”
Then on Github, I found the following code snippet:
add_filter('wp_sitemaps_register_providers', function( $providers ) {
unset( $providers['users'] );
return $providers;
});
However, putting it in my child theme’s functions.php does not remove the “users” link from the generated sitemap.
How do I remove that last line from the sitemap?