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
This commit is contained in:
@@ -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 ) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user