Skip to content

Commit eded474

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@60072 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e47de97 commit eded474

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/wp-admin/includes/class-wp-privacy-requests-table.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,20 @@ protected function get_request_counts() {
116116
return $counts;
117117
}
118118

119-
$query = "
120-
SELECT post_status, COUNT( * ) AS num_posts
121-
FROM {$wpdb->posts}
122-
WHERE post_type = %s
123-
AND post_name = %s
124-
GROUP BY post_status";
125-
126-
$results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A );
127-
$counts = array_fill_keys( get_post_stati(), 0 );
119+
$results = (array) $wpdb->get_results(
120+
$wpdb->prepare(
121+
"SELECT post_status, COUNT( * ) AS num_posts
122+
FROM {$wpdb->posts}
123+
WHERE post_type = %s
124+
AND post_name = %s
125+
GROUP BY post_status",
126+
$this->post_type,
127+
$this->request_type
128+
),
129+
ARRAY_A
130+
);
131+
132+
$counts = array_fill_keys( get_post_stati(), 0 );
128133

129134
foreach ( $results as $row ) {
130135
$counts[ $row['post_status'] ] = $row['num_posts'];

0 commit comments

Comments
 (0)