From b5ecdb1c9c619188d29ce9c246cef1f04dded549 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 18 Mar 2023 12:32:54 +0000 Subject: [PATCH] Coding Standards: Remove unused variables in `WP_Comment_Query`. * `$unapproved_ids` and `$unapproved_emails` in `WP_Comment_Query::get_comment_ids()` were added in [29965] and appear to never have been used. * `$wpdb` in `WP_Comment_Query::fill_descendants()` was replaced with `$this->db` in [38275], removed in [38446], and accidentally reinstated in [38768]. Follow-up to [29965], [34546], [37625], [38275], [38446], [38768], [44546]. Props upadalavipul, dingo_d, audrasjb, SergeyBiryukov. Fixes #57482. git-svn-id: https://develop.svn.wordpress.org/trunk@55559 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-comment-query.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php index b4c8445f27..eace9ccd01 100644 --- a/src/wp-includes/class-wp-comment-query.php +++ b/src/wp-includes/class-wp-comment-query.php @@ -584,8 +584,6 @@ class WP_Comment_Query { if ( ! empty( $this->query_vars['include_unapproved'] ) ) { $include_unapproved = wp_parse_list( $this->query_vars['include_unapproved'] ); - $unapproved_ids = array(); - $unapproved_emails = array(); foreach ( $include_unapproved as $unapproved_identifier ) { // Numeric values are assumed to be user IDs. if ( is_numeric( $unapproved_identifier ) ) { @@ -1013,14 +1011,10 @@ class WP_Comment_Query { * * @since 4.4.0 * - * @global wpdb $wpdb WordPress database abstraction object. - * * @param WP_Comment[] $comments Array of top-level comments whose descendants should be filled in. * @return array */ protected function fill_descendants( $comments ) { - global $wpdb; - $levels = array( 0 => wp_list_pluck( $comments, 'comment_ID' ), );