Make WordPress Core

Changeset 60072


Ignore:
Timestamp:
03/24/2025 07:57:43 PM (5 weeks ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-privacy-requests-table.php

    r59865 r60072  
    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 ) {
Note: See TracChangeset for help on using the changeset viewer.