Make WordPress Core

Ticket #14997: wp_query_bits.diff

File wp_query_bits.diff, 3.0 KB (added by scribu, 15 years ago)
  • wp-includes/query.php

     
    22572257                // Apply post-paging filters on where and join.  Only plugins that
    22582258                // manipulate paging queries should use these hooks.
    22592259                if ( !$q['suppress_filters'] ) {
     2260                        $distinct       = apply_filters_ref_array( 'posts_distinct',    array( $distinct, &$this ) );
     2261                        $fields         = apply_filters_ref_array( 'posts_fields',              array( $fields, &$this ) );
    22602262                        $where          = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
     2263                        $join           = apply_filters_ref_array( 'posts_join_paged',  array( $join, &$this ) );
    22612264                        $groupby        = apply_filters_ref_array( 'posts_groupby',             array( $groupby, &$this ) );
    2262                         $join           = apply_filters_ref_array( 'posts_join_paged',  array( $join, &$this ) );
    22632265                        $orderby        = apply_filters_ref_array( 'posts_orderby',             array( $orderby, &$this ) );
    2264                         $distinct       = apply_filters_ref_array( 'posts_distinct',    array( $distinct, &$this ) );
    2265                         $limits         = apply_filters_ref_array( 'post_limits',               array( $limits, &$this ) );
    2266                         $fields         = apply_filters_ref_array( 'posts_fields',              array( $fields, &$this ) );
     2266                        $limits         = apply_filters_ref_array( 'post_limits',               array( $limits, &$this ) );     
    22672267                }
    22682268
     2269                $bits = array();
     2270                foreach ( array('distinct', 'fields', 'where', 'join', 'groupby', 'orderby', 'limits') as $var ) {
     2271                        $bits[ $var ] = $$var;
     2272                        unset( $$var ); // so we can use EXTR_SKIP below
     2273                }
     2274
     2275                $bits = apply_filters_ref_array( 'wp_query_bits', array( $bits, &$this ) );
     2276
     2277                extract( $bits, EXTR_SKIP );
     2278
    22692279                // Announce current selection parameters.  For use by caching plugins.
    22702280                do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
    22712281
    22722282                // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
    22732283                if ( !$q['suppress_filters'] ) {
     2284                        $distinct       = apply_filters_ref_array( 'posts_distinct_request',array( $distinct, &$this ) );
     2285                        $fields         = apply_filters_ref_array( 'posts_fields_request',      array( $fields, &$this ) );
    22742286                        $where          = apply_filters_ref_array( 'posts_where_request',       array( $where, &$this ) );
    2275                         $groupby        = apply_filters_ref_array( 'posts_groupby_request',             array( $groupby, &$this ) );
    22762287                        $join           = apply_filters_ref_array( 'posts_join_request',        array( $join, &$this ) );
    2277                         $orderby        = apply_filters_ref_array( 'posts_orderby_request',             array( $orderby, &$this ) );
    2278                         $distinct       = apply_filters_ref_array( 'posts_distinct_request',    array( $distinct, &$this ) );
    2279                         $fields         = apply_filters_ref_array( 'posts_fields_request',              array( $fields, &$this ) );
    2280                         $limits         = apply_filters_ref_array( 'post_limits_request',               array( $limits, &$this ) );
     2288                        $groupby        = apply_filters_ref_array( 'posts_groupby_request',     array( $groupby, &$this ) );
     2289                        $orderby        = apply_filters_ref_array( 'posts_orderby_request',     array( $orderby, &$this ) );
     2290                        $limits         = apply_filters_ref_array( 'post_limits_request',       array( $limits, &$this ) );
    22812291                }
    22822292
    22832293                if ( ! empty($groupby) )