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
This commit is contained in:
Sergey Biryukov
2025-03-24 19:59:33 +00:00
parent 58dbe3e577
commit 94bac1c6b3
2 changed files with 14 additions and 9 deletions

View File

@@ -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'];

View File

@@ -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.