Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Display total number of contributors

@henrywright

Moderator

@dta_madrid

Further to @shanebp’s method, WordPress has a function called count_users() which can be used to get the number of users in each role.

https://codex.wordpress.org/Function_Reference/count_users

$users = count_users();

// display total users (if you want to).
echo $users['total_users'] . ' total users';

// display count for contributors. 
foreach( $users['avail_roles'] as $role => $count ) {
    if ( $role == 'contributor' )
        echo $count . ' contributors';
}
Skip to toolbar