Ticket #17025: 17025.5.diff
File 17025.5.diff, 1.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/author-template.php
342 342 $return = ''; 343 343 344 344 $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) ); 345 $query_args['fields'] = 'ids';346 $authors = get_users( $query_args );347 345 348 346 $author_count = array(); 349 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 ) 347 $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" ); 348 349 foreach ( (array) $rows as $row ) { 350 350 $author_count[$row->post_author] = $row->count; 351 } 351 352 353 if ( $hide_empty ) { 354 $query_args['include'] = wp_list_pluck( $rows, 'post_author' ); 355 } else { 356 $query_args['fields'] = 'ids'; 357 } 358 359 /** 360 * Filter the list of found authors. 361 * 362 * @since 4.0.0 363 * 364 * @param array $authors Array of WP_User objects for found authors. 365 * @param array $query_args User query arguments. 366 */ 367 $authors = apply_filters( 'wp_list_authors', get_users( $query_args ), $query_args ); 368 352 369 foreach ( $authors as $author_id ) { 353 370 $author = get_userdata( $author_id ); 354 371