Make WordPress Core

Ticket #57011: 57011.diff

File 57011.diff, 844 bytes (added by peterwilsoncc, 2 years ago)
  • src/wp-includes/author-template.php

    diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php
    index b4c344dcbc..c2141517c2 100644
    a b function wp_list_authors( $args = '' ) { 
    481481        $post_counts = apply_filters( 'pre_wp_list_authors_post_counts_query', false, $parsed_args );
    482482
    483483        if ( ! is_array( $post_counts ) ) {
    484                 $post_counts = $wpdb->get_results(
     484                $post_counts       = array();
     485                $post_counts_query = $wpdb->get_results(
    485486                        "SELECT DISTINCT post_author, COUNT(ID) AS count
    486487                        FROM $wpdb->posts
    487488                        WHERE " . get_private_posts_cap_sql( 'post' ) . '
    488489                        GROUP BY post_author'
    489490                );
    490491
    491                 foreach ( (array) $post_counts as $row ) {
     492                foreach ( (array) $post_counts_query as $row ) {
    492493                        $post_counts[ $row->post_author ] = $row->count;
    493494                }
    494495        }