This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Can ajax search pro use relevanssi_do_query for live results?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Can ajax search pro use relevanssi_do_query for live results? Reply To: Can ajax search pro use relevanssi_do_query for live results?

#32051
Ernest MarcinkoErnest Marcinko
Keymaster

That is probably it. Well, I belive the only thing I can suggest doing here is maybe using a custom code.

Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter('asp_search_phrase_before_cleaning', 'asp_replace_characters', 10, 1);
add_filter('asp_query_args', 'asp_replace_characters', 10, 1);

function asp_replace_characters( $s ) {
  $characters = "‘'"; // Type characters one after another
  $replace_with = '’';     // Replace them with this (space by default)

  if ( is_array($s) ) {
    if ( isset($s['s']) && !$s['_ajax_search'] ) 
      $s['s'] = str_replace(str_split($characters), $replace_with, $s['s']);      
  } else {
    $s = str_replace(str_split($characters), $replace_with, $s);
  }

  return $s; 
}