Skip to content

Commit 96e39e2

Browse files
committed
Users: Remove duplicate query generation from count_many_users_posts().
Removes duplicate code generating the `WHERE` clause and SQL query from the function. Follow up to [60941]. Props spacedmonkey. Fixes #63045. git-svn-id: https://develop.svn.wordpress.org/trunk@60981 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7ca6989 commit 96e39e2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/wp-includes/user.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,7 @@ function count_many_users_posts( $users, $post_type = 'post', $public_only = fal
699699
$count = wp_cache_get_salted( $cache_key, 'post-queries', $cache_salts );
700700

701701
if ( false === $count ) {
702-
$where = get_posts_by_author_sql( $post_type, true, null, $public_only );
703-
$result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N );
702+
$result = $wpdb->get_results( $query, ARRAY_N );
704703

705704
$count = array_fill_keys( $users, 0 );
706705
foreach ( $result as $row ) {

0 commit comments

Comments
 (0)