Skip to content

Commit 22427df

Browse files
committed
Mike filter suppression. Props DD32. see WordPress#7326
git-svn-id: https://develop.svn.wordpress.org/trunk@8773 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b647b13 commit 22427df

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

wp-includes/query.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ function parse_query ($query) {
778778
if ( !empty($qv['post_status']) )
779779
$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
780780

781-
if ( $this->is_posts_page && !$qv['withcomments'] )
781+
if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
782782
$this->is_comment_feed = false;
783783

784784
$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
@@ -832,7 +832,9 @@ function &get_posts() {
832832
$join = '';
833833
$search = '';
834834
$groupby = '';
835+
$fields = "$wpdb->posts.*";
835836
$post_status_join = false;
837+
$page = 1;
836838

837839
if ( !isset($q['caller_get_posts']) )
838840
$q['caller_get_posts'] = false;
@@ -1432,15 +1434,17 @@ function &get_posts() {
14321434
$where = "AND 0";
14331435
}
14341436

1437+
$orderby = $q['orderby'];
1438+
14351439
// Apply post-paging filters on where and join. Only plugins that
14361440
// manipulate paging queries should use these hooks.
14371441
if ( !$q['suppress_filters'] ) {
14381442
$where = apply_filters('posts_where_paged', $where);
14391443
$groupby = apply_filters('posts_groupby', $groupby);
14401444
$join = apply_filters('posts_join_paged', $join);
1441-
$orderby = apply_filters('posts_orderby', $q['orderby']);
1445+
$orderby = apply_filters('posts_orderby', $orderby);
14421446
$distinct = apply_filters('posts_distinct', $distinct);
1443-
$fields = apply_filters('posts_fields', "$wpdb->posts.*");
1447+
$fields = apply_filters('posts_fields', $fields);
14441448
$limits = apply_filters( 'post_limits', $limits );
14451449
}
14461450

@@ -1466,9 +1470,9 @@ function &get_posts() {
14661470
if ( !empty($limits) )
14671471
$found_rows = 'SQL_CALC_FOUND_ROWS';
14681472

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";
14701474
if ( !$q['suppress_filters'] )
1471-
$this->request = apply_filters('posts_request', $request);
1475+
$this->request = apply_filters('posts_request', $this->request);
14721476

14731477
$this->posts = $wpdb->get_results($this->request);
14741478
// Raw results filter. Prior to status checks.

0 commit comments

Comments
 (0)