One option is to use an SQL statement but WordPress provides a nice function called count_users.
When you call this function it will output a result like this.
Result
[code]
array (
'total_users' => 6,
'avail_roles' =>
array (
'administrator' => 2,
'editor' => 2,
'subscriber' => 2,
),
)
[/code]
Here is how to use it.
[code]
$result = count_users();
$total_cnt = empty( $result[ 'total_users' ] ) ? 0 : $result[ 'total_users' ];
echo 'Count: ' . $total_cnt;
[/code]
Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer