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

Reply To: Search results page not found when hitting return or clicking the magnifying

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search results page not found when hitting return or clicking the magnifying Reply To: Search results page not found when hitting return or clicking the magnifying

#36199
robratliff85robratliff85
Participant

Here’s what I’ve tried using the code you sent, but it still treats x400 like searching for x400
/* Replace Keywords */

add_filter( ‘asp_query_args’, ‘asp_replace_search_keywords’, 10, 2 );
function asp_replace_search_keywords( $args, $id ) {
/**
* Add as many words as you want. On the left side place the
* word or words separated by comma to replace.
* To the right side, place the single word to replace it with.
*/
$replace = array(
‘x400’ => ‘x-400’, // Replace ‘word1’ with ‘word2’
‘x600m, x-600-m’ => ‘x-600m’, // Replace ‘word3’ and ‘word4’ with ‘word5’
);

// —————————————-
// Do not change anything below this line
// —————————————-
foreach ( $replace as $k => $w ) {
$kr = explode(‘,’, $k);
foreach ($kr as $krk => &$krv) {
$krv = trim($krv);
if ( $krv == ” ) {
unset($kr[$krk]);
} else {
$krv = ‘/\b’ . $krv . ‘\b/u’;
}
}
if ( count($krv) > 0 ) {
$args[‘s’] = preg_replace($kr, $w, $args[‘s’]);
}
}
return $args;
}