Ticket #23498: 23498.5.diff
File 23498.5.diff, 2.5 KB (added by , 5 years ago) |
---|
-
src/wp-includes/author-template.php
379 379 * @link https://developer.wordpress.org/reference/functions/wp_list_authors/ 380 380 * 381 381 * @since 1.2.0 382 * @since 5.3.0 The `$exclude_admin` parameter was updated to exclude all administrators. 382 383 * 383 384 * @global wpdb $wpdb WordPress database abstraction object. 384 385 * … … 391 392 * @type string $order Sorting direction for $orderby. Accepts 'ASC', 'DESC'. Default 'ASC'. 392 393 * @type int $number Maximum authors to return or display. Default empty (all authors). 393 394 * @type bool $optioncount Show the count in parenthesis next to the author's name. Default false. 394 * @type bool $exclude_admin Whether to exclude the 'admin' account, if it exists. Default true.395 * @type bool $exclude_admin Whether to exclude administrator accounts. Default true. 395 396 * @type bool $show_fullname Whether to show the author's full name. Default false. 396 397 * @type bool $hide_empty Whether to hide any authors with no posts. Default true. 397 398 * @type string $feed If not empty, show a link to the author's feed and use this text as the alt … … 434 435 435 436 $return = ''; 436 437 437 $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); 438 $query_args['fields'] = 'ids'; 439 $authors = get_users( $query_args ); 438 $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); 440 439 440 $query_args['fields'] = 'ID'; 441 442 if ( $args['exclude_admin'] ) { 443 $query_args['exclude'] = get_users( array( 444 'role' => 'administrator', 445 'fields' => 'ID', 446 ) ); 447 } 448 449 $authors = get_users( $query_args ); 450 441 451 $author_count = array(); 442 452 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 ) { 443 453 $author_count[ $row->post_author ] = $row->count; … … 451 461 452 462 $author = get_userdata( $author_id ); 453 463 454 if ( $args['exclude_admin'] && 'admin' === $author->display_name ) {455 continue;456 }457 458 464 if ( $args['show_fullname'] && $author->first_name && $author->last_name ) { 459 465 $name = "$author->first_name $author->last_name"; 460 466 } else {