From c064ac690c27e26d31733d1af09e302b4dff54be Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 3 May 2016 16:14:28 +0000 Subject: [PATCH] `date_query` should be a property on `WP_Comment_Query` objects. Instead of a local variable. Props flixos90. Fixes #36741. git-svn-id: https://develop.svn.wordpress.org/trunk@37354 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-comment-query.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php index eae452f542..771123ff5a 100644 --- a/src/wp-includes/class-wp-comment-query.php +++ b/src/wp-includes/class-wp-comment-query.php @@ -833,10 +833,9 @@ class WP_Comment_Query { } } - $date_query = $this->query_vars['date_query']; - if ( ! empty( $date_query ) && is_array( $date_query ) ) { - $date_query_object = new WP_Date_Query( $date_query, 'comment_date' ); - $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $date_query_object->get_sql() ); + if ( ! empty( $this->query_vars['date_query'] ) && is_array( $this->query_vars['date_query'] ) ) { + $this->date_query = new WP_Date_Query( $this->query_vars['date_query'], 'comment_date' ); + $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() ); } $where = implode( ' AND ', $this->sql_clauses['where'] );