From 661e41e55b52520f49a98633cf6fd472066b9319 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 21 Dec 2010 16:27:34 +0000 Subject: [PATCH] Retrieve only IDs and then do a user fetch loop so that all required user data is present. Props scribu. fixes #15888 git-svn-id: https://develop.svn.wordpress.org/trunk@17100 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/author-template.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php index 5ceb5d31f0..641b69d46f 100644 --- a/wp-includes/author-template.php +++ b/wp-includes/author-template.php @@ -284,13 +284,16 @@ function wp_list_authors($args = '') { $return = ''; - $authors = get_users( wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) ) ); + $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) ); + $query_args['fields'] = 'ids'; + $authors = get_users( $query_args ); $author_count = array(); foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row ) $author_count[$row->post_author] = $row->count; - foreach ( $authors as $author ) { + foreach ( $authors as $author_id ) { + $author = get_userdata( $author_id ); if ( $exclude_admin && 'admin' == $author->display_name ) continue;