WordPress.org

Make WordPress Core

Ticket #17025: list-authors_filter_3.2.patch

File list-authors_filter_3.2.patch, 874 bytes (added by kevinB, 3 years ago)

query filter for wp_list_authors()

  • wp-includes/author-template.php

     
    291291        $authors = get_users( $query_args ); 
    292292 
    293293        $author_count = array(); 
    294         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 ) 
     294        foreach ( (array) $wpdb->get_results( apply_filters( 'list_authors_query', "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", $args ) ) as $row ) 
    295295                $author_count[$row->post_author] = $row->count; 
    296296 
    297297        foreach ( $authors as $author_id ) {