From a81ae76e8da2a3dbe408dc49ddafae81aba3ff24 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 19 Oct 2025 21:44:28 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@60981 git-svn-id: http://core.svn.wordpress.org/trunk@60317 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 3 +-- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index 481aba1a56..c5f20f7d5f 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -699,8 +699,7 @@ function count_many_users_posts( $users, $post_type = 'post', $public_only = fal $count = wp_cache_get_salted( $cache_key, 'post-queries', $cache_salts ); if ( false === $count ) { - $where = get_posts_by_author_sql( $post_type, true, null, $public_only ); - $result = $wpdb->get_results( "SELECT post_author, COUNT(*) FROM $wpdb->posts $where AND post_author IN ($userlist) GROUP BY post_author", ARRAY_N ); + $result = $wpdb->get_results( $query, ARRAY_N ); $count = array_fill_keys( $users, 0 ); foreach ( $result as $row ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index fe05c6c41a..06ef479e43 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-60980'; +$wp_version = '6.9-alpha-60981'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.