Changeset 6467 for trunk/wp-includes/query.php
- Timestamp:
- 12/22/2007 08:19:10 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r6435 r6467 750 750 $groupby = ''; 751 751 752 if ( !isset($q['post_type']) ) 753 $q['post_type'] = 'post'; 752 if ( !isset($q['post_type']) ) { 753 if ( $this->is_search ) 754 $q['post_type'] = 'any'; 755 else 756 $q['post_type'] = 'post'; 757 } 754 758 $post_type = $q['post_type']; 755 759 if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 ) … … 886 890 if ($q['sentence']) { 887 891 $q['search_terms'] = array($q['s']); 888 } 889 else { 892 } else { 890 893 preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q[s], $matches); 891 894 $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]); … … 898 901 $searchand = ' AND '; 899 902 } 900 $term = addslashes_gpc($q['s']);903 $term = $wpdb->escape($q['s']); 901 904 if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) 902 905 $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')"; … … 1146 1149 } elseif ($this->is_single) { 1147 1150 $where .= " AND post_type = 'post'"; 1151 } elseif ( 'any' == $post_type ) { 1152 $where .= ''; 1148 1153 } else { 1149 1154 $where .= " AND post_type = '$post_type'";
Note: See TracChangeset
for help on using the changeset viewer.