Ticket #7326: 7326.2.diff
File 7326.2.diff, 2.2 KB (added by , 13 years ago) |
---|
-
wp-includes/query.php
778 778 if ( !empty($qv['post_status']) ) 779 779 $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']); 780 780 781 if ( $this->is_posts_page && !$qv['withcomments'])781 if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) ) 782 782 $this->is_comment_feed = false; 783 783 784 784 $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment; … … 832 832 $join = ''; 833 833 $search = ''; 834 834 $groupby = ''; 835 $fields = "$wpdb->posts.*"; 835 836 $post_status_join = false; 837 $page = 1; 836 838 837 839 if ( !isset($q['caller_get_posts']) ) 838 840 $q['caller_get_posts'] = false; … … 1432 1434 $where = "AND 0"; 1433 1435 } 1434 1436 1437 $orderby = $q['orderby']; 1438 1435 1439 // Apply post-paging filters on where and join. Only plugins that 1436 1440 // manipulate paging queries should use these hooks. 1437 1441 if ( !$q['suppress_filters'] ) { 1438 1442 $where = apply_filters('posts_where_paged', $where); 1439 1443 $groupby = apply_filters('posts_groupby', $groupby); 1440 1444 $join = apply_filters('posts_join_paged', $join); 1441 $orderby = apply_filters('posts_orderby', $ q['orderby']);1445 $orderby = apply_filters('posts_orderby', $orderby); 1442 1446 $distinct = apply_filters('posts_distinct', $distinct); 1443 $fields = apply_filters('posts_fields', "$wpdb->posts.*");1447 $fields = apply_filters('posts_fields', $fields); 1444 1448 $limits = apply_filters( 'post_limits', $limits ); 1445 1449 } 1446 1450 … … 1466 1470 if ( !empty($limits) ) 1467 1471 $found_rows = 'SQL_CALC_FOUND_ROWS'; 1468 1472 1469 $ request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";1473 $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 1470 1474 if ( !$q['suppress_filters'] ) 1471 $this->request = apply_filters('posts_request', $ request);1475 $this->request = apply_filters('posts_request', $this->request); 1472 1476 1473 1477 $this->posts = $wpdb->get_results($this->request); 1474 1478 // Raw results filter. Prior to status checks.