Ticket #17025: 17025.optimizeforeach.diff
File 17025.optimizeforeach.diff, 834 bytes (added by , 8 years ago) |
---|
-
wp-includes/author-template.php
380 380 $authors = get_users( $query_args ); 381 381 382 382 $author_count = array(); 383 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 ) { 383 384 $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" ); 385 386 foreach ( $rows as $row ) { 384 387 $author_count[$row->post_author] = $row->count; 385 388 } 386 389 foreach ( $authors as $author_id ) {