Make WordPress Core

Ticket #17025: 17025.2.diff

File 17025.2.diff, 1.0 KB (added by DrewAPicture, 11 years ago)

filter docs

  • src/wp-includes/author-template.php

     
    283283        $query_args['fields'] = 'ids';
    284284        $authors = get_users( $query_args );
    285285
     286        $sql = "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";
     287
     288        /**
     289         * Filter the authors SQL query.
     290         *
     291         * @since 3.7.0
     292         *
     293         * @param string $sql The authors SQL query.
     294         */
     295        $rows = $wpdb->get_results( apply_filters( 'list_authors_query', $sql ) );
     296
    286297        $author_count = array();
    287         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 )
     298        foreach ( (array) $rows as $row )
    288299                $author_count[$row->post_author] = $row->count;
    289300
    290301        foreach ( $authors as $author_id ) {