Languages: English • Italiano • (Add your language)
Returns the count of users having each role, as well as the count of all users.
<?php count_users( $strategy ); ?>
The call to count_users returns the number of users with each role. It will not return any roles having count == 0, so the results are intended to be used in foreach loops.
<?php
$result = count_users();
echo 'There are ', $result['total_users'], ' total users';
foreach($result['avail_roles'] as $role => $count)
echo ', ', $count, ' are ', $role, 's';
echo '.';
?>
count_users() is located in wp-includes/user.php
.
Count Tags: wp_count_posts(), wp_count_terms(), wp_count_comments(), count_users()