Add like_escape() to some queries. fixes #15764

git-svn-id: https://develop.svn.wordpress.org/trunk@16999 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2010-12-16 14:22:41 +00:00
parent f75e632dd0
commit c1e26ef82c
7 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -2045,11 +2045,11 @@ class WP_Query {
$n = !empty($q['exact']) ? '' : '%';
$searchand = '';
foreach( (array) $q['search_terms'] as $term ) {
$term = addslashes_gpc($term);
$term = esc_sql( like_escape( $term ) );
$search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
$searchand = ' AND ';
}
$term = esc_sql($q['s']);
$term = esc_sql( like_escape( $q['s'] ) );
if ( empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
$search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')";