WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/wp-includes/query.php

    r8559 r8795  
    776776            $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
    777777
    778         if ( $this->is_posts_page && !$qv['withcomments'] )
     778        if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
    779779            $this->is_comment_feed = false;
    780780
     
    830830        $search = '';
    831831        $groupby = '';
     832        $fields = "$wpdb->posts.*";
    832833        $post_status_join = false;
     834        $page = 1;
     835
     836        if ( !isset($q['suppress_filters']) )
     837            $q['suppress_filters'] = false;
    833838
    834839        if ( !isset($q['post_type']) ) {
     
    13621367        // Apply filters on where and join prior to paging so that any
    13631368        // manipulations to them are reflected in the paging by day queries.
    1364         $where = apply_filters('posts_where', $where);
    1365         $join = apply_filters('posts_join', $join);
     1369        if ( !$q['suppress_filters'] ) {
     1370            $where = apply_filters('posts_where', $where);
     1371            $join = apply_filters('posts_join', $join);
     1372        }
    13661373
    13671374        // Paging
     
    13951402            }
    13961403
    1397             $cjoin = apply_filters('comment_feed_join', $cjoin);
    1398             $cwhere = apply_filters('comment_feed_where', $cwhere);
    1399             $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
     1404            if ( !$q['suppress_filters'] ) {
     1405                $cjoin = apply_filters('comment_feed_join', $cjoin);
     1406                $cwhere = apply_filters('comment_feed_where', $cwhere);
     1407                $cgroupby = apply_filters('comment_feed_groupby', $cgroupby);
     1408            }
    14001409
    14011410            $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss'));
     
    14151424        }
    14161425
     1426        $orderby = $q['orderby'];
     1427
    14171428        // Apply post-paging filters on where and join.  Only plugins that
    14181429        // manipulate paging queries should use these hooks.
    1419 
    1420         $where = apply_filters('posts_where_paged', $where);
    1421         $groupby = apply_filters('posts_groupby', $groupby);
    1422         $join = apply_filters('posts_join_paged', $join);
    1423         $orderby = apply_filters('posts_orderby', $q['orderby']);
    1424         $distinct = apply_filters('posts_distinct', $distinct);
    1425         $fields = apply_filters('posts_fields', "$wpdb->posts.*");
    1426         $limits = apply_filters( 'post_limits', $limits );
     1430        if ( !$q['suppress_filters'] ) {
     1431            $where = apply_filters('posts_where_paged', $where);
     1432            $groupby = apply_filters('posts_groupby', $groupby);
     1433            $join = apply_filters('posts_join_paged', $join);
     1434            $orderby = apply_filters('posts_orderby', $orderby);
     1435            $distinct = apply_filters('posts_distinct', $distinct);
     1436            $fields = apply_filters('posts_fields', $fields);
     1437            $limits = apply_filters( 'post_limits', $limits );
     1438        }
    14271439
    14281440        // Announce current selection parameters.  For use by caching plugins.
     
    14301442
    14311443        // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
    1432         $where = apply_filters('posts_where_request', $where);
    1433         $groupby = apply_filters('posts_groupby_request', $groupby);
    1434         $join = apply_filters('posts_join_request', $join);
    1435         $orderby = apply_filters('posts_orderby_request', $orderby);
    1436         $distinct = apply_filters('posts_distinct_request', $distinct);
    1437         $fields = apply_filters('posts_fields_request', $fields);
    1438         $limits = apply_filters( 'post_limits_request', $limits );
     1444        if ( !$q['suppress_filters'] ) {
     1445            $where = apply_filters('posts_where_request', $where);
     1446            $groupby = apply_filters('posts_groupby_request', $groupby);
     1447            $join = apply_filters('posts_join_request', $join);
     1448            $orderby = apply_filters('posts_orderby_request', $orderby);
     1449            $distinct = apply_filters('posts_distinct_request', $distinct);
     1450            $fields = apply_filters('posts_fields_request', $fields);
     1451            $limits = apply_filters( 'post_limits_request', $limits );
     1452        }
    14391453
    14401454        if ( ! empty($groupby) )
     
    14461460            $found_rows = 'SQL_CALC_FOUND_ROWS';
    14471461
    1448         $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
    1449         $this->request = apply_filters('posts_request', $request);
     1462        $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
     1463        if ( !$q['suppress_filters'] )
     1464            $this->request = apply_filters('posts_request', $this->request);
    14501465
    14511466        $this->posts = $wpdb->get_results($this->request);
    14521467        // Raw results filter.  Prior to status checks.
    1453         $this->posts = apply_filters('posts_results', $this->posts);
     1468        if ( !$q['suppress_filters'] )
     1469            $this->posts = apply_filters('posts_results', $this->posts);
    14541470
    14551471        if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
     
    14981514        }
    14991515
    1500         $this->posts = apply_filters('the_posts', $this->posts);
     1516        if ( !$q['suppress_filters'] )
     1517            $this->posts = apply_filters('the_posts', $this->posts);
    15011518
    15021519        update_post_caches($this->posts);
Note: See TracChangeset for help on using the changeset viewer.