I use WordPress for customer websites with the Divi theme and layouts however WordPress is fundamentally a blogging platform so its sitemap.xml contains links to categories and users and you might not want to have those publicised and indexed by Google
The following snippet tells WordPress to skip a couple of the things it normally includes in the sitemap. In this case categories (taxonomies) and the users
Add this to your themes functions.php
add_filter( 'wp_sitemaps_add_provider', function ($provider, $name) {
return ( in_array( $name, [ 'users', 'taxonomies' ])) ? false : $provider;
}, 10, 2);
0 Comments