fix textual search in terms names

This commit is contained in:
Leo Germani 2018-09-12 18:38:54 -03:00
parent 8e16284851
commit efbd349f17
1 changed files with 4 additions and 4 deletions

View File

@ -329,14 +329,14 @@ class Search_Engine {
$searchand = '';
$searchSlug = '';
foreach ( $search_terms as $term ) {
$term = $wpdb->prepare("%s", $exact ? $term : "%". sanitize_title_with_dashes($term) . "%");
$searchSlug .= "{$searchand}(tter.slug LIKE $term)";
$term = $wpdb->prepare("%s", $exact ? $term : "%". $term . "%");
$searchSlug .= "{$searchand}(tter.name LIKE $term)";
$searchand = ' AND ';
}
$term = $wpdb->prepare("%s", $exact ? $term : "%". sanitize_title_with_dashes($s) . "%");
$term = $wpdb->prepare("%s", $exact ? $term : "%". $s . "%");
if ( count( $search_terms ) > 1 && $search_terms[0] != $s ) {
$searchSlug = "($searchSlug) OR (tter.slug LIKE $term)";
$searchSlug = "($searchSlug) OR (tter.name LIKE $term)";
}
if ( !empty( $searchSlug ) )
$search = " OR ({$searchSlug}) ";