List total number of users that are authors
Question
I want to display total number of Authors and total number of subscribers on the blog but exclude the admin in this way:
56 Authors so far
15 Subscribers so far
Code that is close to what I need :)
I have this code and it displays the total number of everybody that is registered. I need it to display authors and subscriber roles separately. Please help :)
?php $users = $wpdb-get_var("SELECT COUNT(ID) FROM $wpdb-users");
echo $users." members so far"; ?
Answer updated:
Thank You @JanBeck This code generates the number of authors
echo count( get_users( array( 'role' = 'author' ) ) )
Topic list-authors user-roles users Wordpress
Category Web