relevanssi_tag_before_tokenize

apply_filters( 'relevanssi_tag_before_tokenize', string $term_string, array $post_taxonomy_terms, string $taxonomy, int $post_id )

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

Parameters

$term_string
(string) The post taxonomy term content as a string of space-separated term names.

$post_taxonomy_terms
(array) An array of taxonomy term objects.

$taxonomy
(string) The name of the taxonomy.

$post_id
(int) The post ID.

More information

Relevanssi indexes post taxonomy term content one taxonomy at the time. For each taxonomy, Relevanssi uses get_the_terms() to get the taxonomy terms in that taxonomy. Relevanssi adds each term name to a string, separated by spaces, and then tokenizes that string for indexing.

Before the tokenizer runs, the term string goes through this filter hook. You can modify the term string here. For more extensive modifications, it’s best to create a new string from the term objects in the $post_taxonomy_terms array instead of changing the existing string.

Relevanssi uses this filter hook to make WPML taxonomy term indexing work correctly. WPML would index the terms in the current admin language instead of the post language. Relevanssi hooks a function to this filter hook to disable the WPML term translations and gets the terms in the post language.