Make WordPress Core


Ignore:
Timestamp:
10/11/2010 03:04:44 PM (16 years ago)
Author:
scribu
Message:

Introduce wp_query_clauses filter. Fixes #14997

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r15773 r15775  
    21872187                // manipulate paging queries should use these hooks.
    21882188                if ( !$q['suppress_filters'] ) {
     2189                        $distinct       = apply_filters_ref_array( 'posts_distinct',    array( $distinct, &$this ) );
     2190                        $fields         = apply_filters_ref_array( 'posts_fields',              array( $fields, &$this ) );
    21892191                        $where          = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
     2192                        $join           = apply_filters_ref_array( 'posts_join_paged',  array( $join, &$this ) );
    21902193                        $groupby        = apply_filters_ref_array( 'posts_groupby',             array( $groupby, &$this ) );
    2191                         $join           = apply_filters_ref_array( 'posts_join_paged',  array( $join, &$this ) );
    21922194                        $orderby        = apply_filters_ref_array( 'posts_orderby',             array( $orderby, &$this ) );
    2193                         $distinct       = apply_filters_ref_array( 'posts_distinct',    array( $distinct, &$this ) );
    2194                         $limits         = apply_filters_ref_array( 'post_limits',               array( $limits, &$this ) );
    2195                         $fields         = apply_filters_ref_array( 'posts_fields',              array( $fields, &$this ) );
     2195                        $limits         = apply_filters_ref_array( 'post_limits',               array( $limits, &$this ) );     
     2196
     2197                        // Also apply a filter on all clauses at once, for convenience
     2198                        $clauses = array();
     2199                        foreach ( array('distinct', 'fields', 'where', 'join', 'groupby', 'orderby', 'limits') as $var ) {
     2200                                $clauses[ $var ] = $$var;
     2201                                unset( $$var ); // so we can use EXTR_SKIP below
     2202                        }
     2203
     2204                        $clauses = apply_filters_ref_array( 'wp_query_clauses', array( $clauses, &$this ) );
     2205
     2206                        extract( $clauses, EXTR_SKIP );
     2207                        unset( $clauses );
    21962208                }
    21972209
     
    22012213                // Filter again for the benefit of caching plugins.  Regular plugins should use the hooks above.
    22022214                if ( !$q['suppress_filters'] ) {
     2215                        $distinct       = apply_filters_ref_array( 'posts_distinct_request',array( $distinct, &$this ) );
     2216                        $fields         = apply_filters_ref_array( 'posts_fields_request',      array( $fields, &$this ) );
    22032217                        $where          = apply_filters_ref_array( 'posts_where_request',       array( $where, &$this ) );
    2204                         $groupby        = apply_filters_ref_array( 'posts_groupby_request',             array( $groupby, &$this ) );
    22052218                        $join           = apply_filters_ref_array( 'posts_join_request',        array( $join, &$this ) );
    2206                         $orderby        = apply_filters_ref_array( 'posts_orderby_request',             array( $orderby, &$this ) );
    2207                         $distinct       = apply_filters_ref_array( 'posts_distinct_request',    array( $distinct, &$this ) );
    2208                         $fields         = apply_filters_ref_array( 'posts_fields_request',              array( $fields, &$this ) );
    2209                         $limits         = apply_filters_ref_array( 'post_limits_request',               array( $limits, &$this ) );
     2219                        $groupby        = apply_filters_ref_array( 'posts_groupby_request',     array( $groupby, &$this ) );
     2220                        $orderby        = apply_filters_ref_array( 'posts_orderby_request',     array( $orderby, &$this ) );
     2221                        $limits         = apply_filters_ref_array( 'post_limits_request',       array( $limits, &$this ) );
    22102222                }
    22112223
Note: See TracChangeset for help on using the changeset viewer.