diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php
index 2911366f03..6665c4d65d 100644
|
a
|
b
|
function wp_list_authors( $args = '' ) { |
| 437 | 437 | |
| 438 | 438 | $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); |
| 439 | 439 | $query_args['fields'] = 'ids'; |
| 440 | | $authors = get_users( $query_args ); |
| 441 | 440 | |
| 442 | 441 | $author_count = array(); |
| 443 | | foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE " . get_private_posts_cap_sql( 'post' ) . ' GROUP BY post_author' ) as $row ) { |
| | 442 | $rows = $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' ); |
| | 443 | foreach ( $rows as $row ) { |
| 444 | 444 | $author_count[ $row->post_author ] = $row->count; |
| 445 | 445 | } |
| | 446 | |
| | 447 | if ( $args['hide_empty'] ) { |
| | 448 | $query_args['include'] = wp_list_pluck( $rows, 'post_author' ); |
| | 449 | } else { |
| | 450 | $query_args['fields'] = 'ids'; |
| | 451 | } |
| | 452 | |
| | 453 | /** |
| | 454 | * Filters the list of authors. |
| | 455 | * |
| | 456 | * @since 5.9.0 |
| | 457 | * |
| | 458 | * @param array $authors Array of WP_User objects for found authors. |
| | 459 | * @param array $query_args User query arguments. |
| | 460 | */ |
| | 461 | $authors = apply_filters( 'wp_list_authors', get_users( $query_args ), $query_args ); |
| | 462 | |
| 446 | 463 | foreach ( $authors as $author_id ) { |
| 447 | 464 | $posts = isset( $author_count[ $author_id ] ) ? $author_count[ $author_id ] : 0; |
| 448 | 465 | |