Hi bennyb,
– If searched string contains words then it splits string in different keywords and finds posts for each keyword.
Ex: Searching by “Hockey Match” will retrieves all the results which contains “Hockey” or “Match” word.
– If searched string contains single word then finds posts for whole keyword.
Ex: Searching by “Hockey|Match” will retrieves all the results which contains “Hockey|Match” word.
In your case posts saved with “Kamon Nudeln Sushi-Bar│カモン・ヌードル寿司バー” so it can be searched by “Kamon” or “Nudeln” or “Sushi-Bar│カモン・ヌードル寿司バー” or whole word “Kamon Nudeln Sushi-Bar│カモン・ヌードル寿司バー”.
To meet your requirement use following PHP snippet.
/**
* Find out posts with title contains searched keyword.
*/
function gd_snippet_191105_search_better_search_terms( $where, $keywords, $keyword ) {
global $wpdb;
if ( $keyword != '' ) {
$where = ' OR ( ' . $wpdb->posts . '.post_title LIKE "%' . $keyword . '%" )';
}
return $where;
}
add_filter( 'geodir_search_better_search_terms', 'gd_snippet_191105_search_better_search_terms', 20, 3 );
/**
* Find out posts with content contains searched keyword.
*/
function gd_snippet_191105_search_content_where() {
global $wpdb, $s;
if ( $s != '' ) {
$where = ' OR ( ' . $wpdb->posts . '.post_content LIKE "%' . stripslashes( wp_specialchars_decode( $s, ENT_QUOTES ) ) . '%" )';
}
return $where;
}
add_filter( 'geodir_search_content_where', 'gd_snippet_191105_search_content_where', 20 );
Regards,
Kiran