From 7f23254337affaa25515477071bb22673ef88adb Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 14 Dec 2018 17:05:58 +0000 Subject: [PATCH] Networks and Sites: Fix incorrect variable location. This fixes an issue introduced in [44166] where the `$groupby` variable was inserted too low in the `get_site_ids()` function while merging [43832] into `trunk`. The merged location did not account for a new conditional statement that existed only in `trunk`, and would have resulted in values assigned to `$groupby` being erased in certain scenarios. Props spacedmonkey. See #44416. Fixes #45582. git-svn-id: https://develop.svn.wordpress.org/trunk@44186 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-site-query.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-wp-site-query.php b/src/wp-includes/class-wp-site-query.php index d963c5edb4..3d2f4f173b 100644 --- a/src/wp-includes/class-wp-site-query.php +++ b/src/wp-includes/class-wp-site-query.php @@ -570,7 +570,8 @@ class WP_Site_Query { $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() ); } - $join = ''; + $join = ''; + $groupby = ''; if ( ! empty( $this->meta_query_clauses ) ) { $join .= $this->meta_query_clauses['join']; @@ -585,8 +586,6 @@ class WP_Site_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $groupby = ''; - $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); /**