Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ignoring special characters › Reply To: Ignoring special characters
June 25, 2020 at 1:26 pm
#28090
Keymaster
Hi Majid,
Indeed, there is an error in the code, please try this variation:
add_filter('asp_indexing_string_pre_process', 'custom_chars_asp_indexing_string_pre_process', 10, 1);
add_filter('asp_search_phrase_before_cleaning', 'custom_chars_asp_indexing_string_pre_process', 10, 1);
add_filter('asp_query_args', 'custom_chars_asp_indexing_string_pre_process', 10, 1);
function custom_chars_asp_indexing_string_pre_process($s) {
$original = array(
'ī', 'ʻ', 'ā', 'Ṭ', 'ṣ', 'ū'
);
$replace = array(
'i', '', 'a', 't', 's', 'u'
);
// Replace them
if ( is_array($s) ) {
if ( isset($s['s']) && !$s['_ajax_search'] )
$s['s'] = str_replace($original, $replace, $s['s']);
} else {
$s = str_replace($original, $replace, $s);
}
return $s;
}