apply_filters( 'relevanssi_accents_replacement_arrays', array $accent_replacements )
Filters the accent replacement array.
Parameters
$accent_replacements
(array) Array of replacements. The index 'from'
has the source characters, index 'to'
the replacements. The indices 'from_re'
and 'to_re'
has another set of replacements that are made after the first set.
More information
This filter hook is used in the excerpt creation and highlights to include accent variations to the letters. This filter convers single characters to a regex set of variations. Here’s the default value:
array( 'from' => array( 'a', 'c', 'e', 'i', 'o', 'u', 'n' ), 'to' => array( '(?:a|á|à|â)', '(?:c|ç)', '(?:e|é|è|ê|ë)', '(?:i|í|ì|î|ï)', '(?:o|ó|ò|ô|õ)', '(?:u|ú|ù|ü|û)', '(?:n|ñ)' ), 'from_re' => array( "/(s)('|’)?$/", "/<a href="'|’">^(|:</a>/" ), 'to_re' => array( "(?:(?:'|’)?\1|\1(?:'|’)?)", "?('|’)?" ), )
Most of this does not need to be touched. However, if you for example like to see the letter ä considered a variant of a when highlighting, you can add this to your site:
add_filter( 'relevanssi_accents_replacement_arrays', function ( $replacements ) { $replacements['to'][0] = '(?:a|á|à|â|ä)'; return $replacements; });
Now ä is considered another variant of a and searching for haagen-daz would highlight häagen-daz as well.