Ticket #14777: 14777.diff
| File 14777.diff, 2.2 KB (added by , 15 years ago) |
|---|
-
wp-includes/query.php
1185 1185 , 'preview' 1186 1186 , 's' 1187 1187 , 'sentence' 1188 , 'fields' 1188 1189 ); 1189 1190 1190 1191 foreach ( $keys as $key ) { 1191 if ( !isset($array[$key]) )1192 if ( !isset($array[$key]) ) 1192 1193 $array[$key] = ''; 1193 1194 } 1194 1195 … … 1196 1197 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and'); 1197 1198 1198 1199 foreach ( $array_keys as $key ) { 1199 if ( !isset($array[$key]) )1200 if ( !isset($array[$key]) ) 1200 1201 $array[$key] = array(); 1201 1202 } 1202 1203 return $array; … … 1648 1649 $join = ''; 1649 1650 $search = ''; 1650 1651 $groupby = ''; 1651 $fields = "$wpdb->posts.*";1652 $fields = ''; 1652 1653 $post_status_join = false; 1653 1654 $page = 1; 1654 1655 … … 1729 1730 else 1730 1731 $q['no_found_rows'] = false; 1731 1732 1733 switch ( $q['fields'] ) { 1734 case 'ids': 1735 $fields = "$wpdb->posts.ID"; 1736 break; 1737 case 'id=>parent': 1738 $fields = "$wpdb->posts.ID, $wpdb->posts.post_parent"; 1739 break; 1740 default: 1741 $fields = "$wpdb->posts.*"; 1742 } 1743 1732 1744 // If a month is specified in the querystring, load that month 1733 1745 if ( $q['m'] ) { 1734 1746 $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); … … 2272 2284 $groupby = 'GROUP BY ' . $groupby; 2273 2285 if ( !empty( $orderby ) ) 2274 2286 $orderby = 'ORDER BY ' . $orderby; 2287 2275 2288 $found_rows = ''; 2276 2289 if ( !$q['no_found_rows'] && !empty($limits) ) 2277 2290 $found_rows = 'SQL_CALC_FOUND_ROWS'; … … 2280 2293 if ( !$q['suppress_filters'] ) 2281 2294 $this->request = apply_filters_ref_array('posts_request', array( $this->request, &$this ) ); 2282 2295 2296 if ( 'ids' == $q['fields'] ) { 2297 $this->posts = $wpdb->get_col($this->request); 2298 2299 return $this->posts; 2300 } 2301 2302 if ( 'id=>parent' == $q['fields'] ) { 2303 $this->posts = $wpdb->get_results($this->request); 2304 2305 $r = array(); 2306 foreach ( $this->posts as $post ) 2307 $r[ $post->ID ] = $post->post_parent; 2308 2309 return $r; 2310 } 2311 2283 2312 $this->posts = $wpdb->get_results($this->request); 2313 2284 2314 // Raw results filter. Prior to status checks. 2285 2315 if ( !$q['suppress_filters'] ) 2286 2316 $this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) );