apply_filters( 'relevanssi_didyoumean_alphabet', string $alphabet )

Filters the alphabet used for creating Did you mean suggestions in Relevanssi Premium.


(string) The alphabet used, default abcdefghijklmnopqrstuvwxyzäöåü.

More information

When Relevanssi Premium looks for Did you mean suggestions, it starts with the search query and modifies it in a bunch of ways: removing letters, adding letters and shuffling letters. To add letters, Relevanssi needs to know what letters exist in the alphabet. That’s a more complicated question than might appear.

This filter hook can be used to introduce the correct alphabet to Relevanssi, if the default alphabet is not good for your language. Relevanssi and languages has suggestions for different languages, like Arabic, Russian, Polish and Vietnamese, and if you create an alphabet for your own language, please share!

To create a new alphabet, just add a function that returns a string containing all the letters in the alphabet, like this Russian example:

add_filter( 'relevanssi_didyoumean_alphabet', function() { return 'абвгдеёжзийкмнопрстуфхцчшщъыьэюя'; } );