Handle empty search query. Props charleshooper. fixes #3722 #3759

git-svn-id: https://develop.svn.wordpress.org/trunk@4911 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-02-22 01:54:28 +00:00
parent 1d2e3903b2
commit 0a1b1b2e88
1 changed files with 5 additions and 3 deletions

View File

@ -765,9 +765,11 @@ class WP_Query {
$searchand = ' AND ';
}
$term = addslashes_gpc($q['s']);
if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')";
$search = " AND ({$search}) ";
if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
$search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')";
if ( !empty($search) )
$search = " AND ({$search}) ";
}
// Category stuff