How to count get_users query?

I have been searching high and low for a way to count the amount of results from a get_users query.

Most of what I found is to count the total number of posts in a post query, but nothing for counting the total number of users in the get_users query.

Can someone point it out for me? Thanks a lot.

4 Answers
4

when you use get_users() it retrieves an array of users matching the criteria given in $args which means you can simply use PHP’s count() function e.g:

$users = get_users($args);
$number_of_users = count($users);

Leave a Comment