From 0c506aabc05c78a66effa44f1568b59cc2a395c8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 May 2022 11:15:28 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@53375 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-query.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 1c89b8630f..e7eda7bab7 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -2754,6 +2754,8 @@ class WP_Query { } } + $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); + /* * Apply post-paging filters on where and join. Only plugins that * manipulate paging queries should use these hooks. @@ -2833,8 +2835,6 @@ class WP_Query { */ $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); - $clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); - /** * Filters all query clauses at once, for convenience. * @@ -2856,7 +2856,7 @@ class WP_Query { * } * @param WP_Query $query The WP_Query instance (passed by reference). */ - $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $clauses ), &$this ) ); + $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) ); $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; @@ -2967,8 +2967,6 @@ class WP_Query { */ $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); - $clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); - /** * Filters all query clauses at once, for convenience. * @@ -2992,7 +2990,7 @@ class WP_Query { * } * @param WP_Query $query The WP_Query instance (passed by reference). */ - $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $clauses ), &$this ) ); + $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) ); $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';