Exclude Taxonomies From the Yoast Sitemap
Leaves taxonomy sitemaps, such as tags or a plugin's filter attributes, out of the Yoast SEO sitemap index.
Opens WPIDE on
Code
// Taxonomy names to leave out of the sitemap.
$wpide_sitemap_skip_tax = array( 'post_tag', 'post_format' );
add_filter( 'wpseo_sitemap_exclude_taxonomy', function ( $excluded, $taxonomy ) use ( $wpide_sitemap_skip_tax ) {
return in_array( $taxonomy, $wpide_sitemap_skip_tax, true ) ? true : $excluded;
}, 10, 2 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.