If you've had the need to list all authors/contributors on your WordPress site in a sidebar widget, you may have come across the simple, yet effective List Author's plugin.

The plugin is great, except for the "Exclude Admins" feature, which actually only excludes users with the username of "admin".

If you open up list-authors.php and change the following sections, you'll be in business:

} else {
    $author_posts_join = '';
    $author_where = '';
    $author_group_by = "GROUP BY $wpdb->users.ID";
}


// Query the list of users
$sql = "
    SELECT $author_select
    FROM $wpdb->users
    INNER JOIN wp_usermeta
        ON wp_usermeta.user_id = wp_users.ID
    $author_posts_join
    $author_name_join
    $author_cap_join
    $author_where
    AND (wp_usermeta.meta_key = 'wp_user_level' AND wp_usermeta.meta_value < 10)
    $author_group_by
    $author_having
    $author_sort
    $author_limit
    ";

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *