Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Show only results based on a number of words in the title › Reply To: Show only results based on a number of words in the title
April 3, 2023 at 1:26 pm
#42092
Keymaster
Okay. That is not going to be super easy, it will definitely require some custom coding to push an argument for the search phrase. Enforcing an restriction on the searched fields is generally not the best idea, but there is probably a way to do this.
Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
add_filter( 'asp_search_phrase_before_cleaning', 'asp_search_phrase_before_cleaning_add', 10,3 );
function asp_search_phrase_before_cleaning_add($phrase) {
return '"city game" ' . $phrase;
}