Make WordPress Core


Ignore:
Timestamp:
05/10/2022 11:15:28 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Restore the $pieces variable in WP_Query::get_posts().

This is a defensive coding measure that aims to reduce confusion. With this change, $pieces is explicitly used for the names, and $clauses for the values of the clauses.

Follow-up to [52974], [53175], [53370].

Props peterwilsoncc.
See #55699.

File:
1 edited

Legend:

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

    r53370 r53375  
    27552755                }
    27562756
     2757                $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
     2758
    27572759                /*
    27582760                 * Apply post-paging filters on where and join. Only plugins that
     
    28332835                         */
    28342836                        $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
    2835 
    2836                         $clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
    28372837
    28382838                        /**
     
    28572857                         * @param WP_Query $query   The WP_Query instance (passed by reference).
    28582858                         */
    2859                         $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $clauses ), &$this ) );
     2859                        $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
    28602860
    28612861                        $where    = isset( $clauses['where'] ) ? $clauses['where'] : '';
     
    29682968                        $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
    29692969
    2970                         $clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
    2971 
    29722970                        /**
    29732971                         * Filters all query clauses at once, for convenience.
     
    29932991                         * @param WP_Query $query  The WP_Query instance (passed by reference).
    29942992                         */
    2995                         $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $clauses ), &$this ) );
     2993                        $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
    29962994
    29972995                        $where    = isset( $clauses['where'] ) ? $clauses['where'] : '';
Note: See TracChangeset for help on using the changeset viewer.