apply_filters( 'relevanssi_do_not_index_term', boolean $block, WP_Term $term, string $taxonomy )
Controls whether a taxonomy term is indexed or not. If you exclude a term with this filter hook, it won’t be indexed and the term archive page won’t show up in the results. This filter hook has no effect on posts tagged with the term, though.
Parameters
$block
(boolean) If true
, Relevanssi does not index this term. Default false
.
$term
(WP_Term) The term object.
$taxonomy
(string) The term taxonomy name.
More information
This filter hook works like relevanssi_do_not_index
, but for taxonomy terms (and only in Relevanssi Premium, because taxonomy term indexing is not available in the free version).
If you want to avoid indexing specific terms, this filter hook can be used to control the term indexing. For example, to index all terms in the animals
taxonomy, except the child terms of the term bugs
(with the term ID 53), you can do:
add_filter( 'relevanssi_do_not_index_term', 'rlv_animal_control', 10, 3 ); function rlv_animal_control( $block, $term, $taxonomy ) { if ( 'animals' !== $taxonomy ) { return $block; } if ( 53 === $term->parent ) { $block = true; } return $block; }