relevanssi_tax_term_additional_content

apply_filters( 'relevanssi_tax_term_additional_content', string $term_description, WP_Term $term )

This filter hook filters the taxonomy term content before Relevanssi indexes it.

Parameters

$term_description
(string) The term description.

$term
(WP_Term) The term object.

More information

This filter hook mirrors the relevanssi_content_to_index hook that you can use to add content to posts before indexing. This hook does the same, but for taxonomy terms.

When you index taxonomy terms in Relevanssi Premium, Relevanssi indexes the term name and the term description. This filter hook is applied to the term description and is the easiest way to add something to the term description before Relevanssi indexes it:

add_filter( 'relevanssi_tax_term_additional_content', function( $term_description, $term ) {
  return $term_description . ' ' . $term->taxonomy;
}, 10, 2 );

This function would index the term taxonomy along with the description. When using the filter hook, return the current value of $term_description and then add your new content, adding a space between the old and the new content.

You can, for example, use this filter hook to index ACF custom fields for terms.

You can also use the filter hook relevanssi_post_to_index to modify the term name and description before this filter hook or relevanssi_term_add_data to filter the whole term object. That’s the only way to alter the term name before Relevanssi sees it.