From 94bac1c6b33d365a721c564035d1ed74046af416 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 24 Mar 2025 19:59:33 +0000 Subject: [PATCH] Coding Standards: Remove a one-time variable in `WP_Privacy_Requests_Table::get_request_counts()`. This allows the `$wpdb::prepare()` call to be picked up correctly by PHPCS. Follow-up to [43008], [45448]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. Built from https://develop.svn.wordpress.org/trunk@60072 git-svn-id: http://core.svn.wordpress.org/trunk@59408 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-privacy-requests-table.php | 21 ++++++++++++------- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/class-wp-privacy-requests-table.php b/wp-admin/includes/class-wp-privacy-requests-table.php index ba7a899d19..18a82590be 100644 --- a/wp-admin/includes/class-wp-privacy-requests-table.php +++ b/wp-admin/includes/class-wp-privacy-requests-table.php @@ -116,15 +116,20 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table { return $counts; } - $query = " - SELECT post_status, COUNT( * ) AS num_posts - FROM {$wpdb->posts} - WHERE post_type = %s - AND post_name = %s - GROUP BY post_status"; + $results = (array) $wpdb->get_results( + $wpdb->prepare( + "SELECT post_status, COUNT( * ) AS num_posts + FROM {$wpdb->posts} + WHERE post_type = %s + AND post_name = %s + GROUP BY post_status", + $this->post_type, + $this->request_type + ), + ARRAY_A + ); - $results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A ); - $counts = array_fill_keys( get_post_stati(), 0 ); + $counts = array_fill_keys( get_post_stati(), 0 ); foreach ( $results as $row ) { $counts[ $row['post_status'] ] = $row['num_posts']; diff --git a/wp-includes/version.php b/wp-includes/version.php index 1e993b140f..f36de36031 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-beta3-60071'; +$wp_version = '6.8-beta3-60072'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.