Make WordPress Core

Ticket #17025: 17025.7.diff

File 17025.7.diff, 1.1 KB (added by Mte90, 9 years ago)

patch refreshed for 4.6

  • wp-includes/author-template.php

     
    383383        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 ) {
    384384                $author_count[$row->post_author] = $row->count;
    385385        }
     386     
     387      if ( $query_args['hide_empty'] ) {
     388        $query_args['include'] = wp_list_pluck( $rows, 'post_author' );
     389        } else {
     390        $query_args['fields'] = 'ids';
     391        }
     392     
     393      /**
     394         * Filter the found list of authors.
     395         *
     396         * @since 4.6.0
     397         *
     398         * @param array $authors    Array of WP_User objects for found authors.
     399         * @param array $query_args User query arguments.
     400         */
     401       
     402      $authors = apply_filters( 'wp_list_authors', get_users( $query_args ), $query_args );
     403     
    386404        foreach ( $authors as $author_id ) {
    387405                $author = get_userdata( $author_id );
    388406