Skip to content

Commit

Permalink
Handle empty search query. Props charleshooper. fixes #3722 #3759
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/branches/2.1@4912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Feb 22, 2007
1 parent c4e47d3 commit 184928a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wp-includes/query.php
Expand Up @@ -765,9 +765,11 @@ function &get_posts() {
$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
Expand Down

0 comments on commit 184928a

Please sign in to comment.