relevanssi_didyoumean_token

apply_filters( 'relevanssi_didyoumean_token', string $token )

This filter hook lets you modify tokens (words) before the Did you mean corrections.

Parameters

$token
(string) The word from the search query.

More information

When Relevanssi creates the Did you mean suggestions, Relevanssi splits the search query into individual words or tokens. Relevanssi then passes each word into the correction algorithm to get a suggestion. This same process works in free and Premium, even though generating the corrections is different.

The tokens first pass through this filter hook. You can modify the words if you want to, but the most important use for this hook is to prevent Relevanssi from correcting a specific word. If this filter hook returns an empty string, Relevanssi will not look for a correction. If there are words that get corrected wrong, you can disable the correction with a function like this:

add_filter(
  'relevanssi_didyoumean_token',
  function( $token ) {
    $do_not_touch_these = array( '5g', 'word', 'term' );
    if ( in_array( $token, $do_not_touch_these, true ) ) {
      $token = '';
    }
    return $token;
  }
);