[wp-trac] [WordPress Trac] #63004: Allow `count_many_users_posts()` to be short-circuited
WordPress Trac
noreply at wordpress.org
Tue Feb 25 13:10:06 UTC 2025
#63004: Allow `count_many_users_posts()` to be short-circuited
-------------------------+------------------------------------------
Reporter: ethitter | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration, performance
-------------------------+------------------------------------------
Comment (by jigar bhanushali):
Hello @ethitter
I've uploaded the updated patch with additional improvements to the
function.
I've updated the following line to better sanitize user IDs:
From:
php
$userlist = implode( ',', array_map( 'absint', $users ) );
To:
php
$userlist = implode( ',', wp_parse_id_list( $users ) );
I also added:
php
$count = array_fill_keys( $userlist, 0 );
This change eliminates the need for an extra foreach loop.
cc @audrasjb
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63004#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list