How to get the number of admin users on a multisite network?

on a multisite installation I can get how many active users there are by using get_user_count()

how can I get this count that only includes users that have been assigned the role of administrator on any site?

  • Predrag Dubajic
    • Support

    Hey Carlos,

    Hope you’re doing well today :slight_smile:

    Something like this should do the trick:

    $result = count_users();
    $show = array('administrator');
    echo 'We currently have:';
    foreach($result['avail_roles'] as $role => $count){
    if( in_array($role, $show)) {
    echo '
    ', $count, ' ' , $role, 's';

    Let me know if this will work for you :slight_smile:

    Best regards,


  • Dimitris
    • Support Star

    Hey there Carlos,

    I hope everything’s going well for you and don’t mind skipping in! :slight_smile:

    this works but it only returns the count total of current site

    You’re right about that.

    Unfortunately, the get_user_count() function that you were using doesn’t offer but an integer output, so you can’t have any other info in order to test for user roles etc.

    The count_users() function that Pregrad showed to you, is capable to fetch users’ roles BUT seems to work for current blog as we can see in

    Having provided this link, I believe that the best approach would be to clone this function into something like my_ count_users() in order to check for usermeta capabilities under all blogs rather than the current one only.

    I can understand that this may require some custom coding but I’d be more than happy to review any of your efforts and provide some insights and a second look. :slight_smile: If you aren’t feeling confident about it, you can use our Jobs&Pros for some custom work (notice: there’re no WPMU DEV staff members in there).

    Warm regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.