Rank Math Sitemap: Leave Out Taxonomies
Keeps taxonomy archives such as tags or product attributes out of the Rank Math sitemap index.
Opens WPIDE on
Code
// Taxonomies to leave out.
$wpide_rm_skip_tax = array( 'post_tag', 'post_format' );
add_filter( 'rank_math/sitemap/exclude_taxonomy', function ( $exclude, $taxonomy ) use ( $wpide_rm_skip_tax ) {
return in_array( $taxonomy, $wpide_rm_skip_tax, true ) ? true : $exclude;
}, 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.