WPDev.one
Core Function
View Source on Trac ↗

count_users()

count_users( mixed $strategy = 'time', mixed $site_id = null )

Counts number of users who have each of the user roles.

Parameters 2 required

Name / Type Description
string

$strategy Optional. The computational strategy to use when counting the users. Accepts either 'time' or 'memory'. Default 'time'.

Required
(int

| null) $site_id Optional. The site ID to count users for. Defaults to the current site.

Required

Return Value

(array)
array { User counts.

Function Information

Since Version
3.0.0
Source File
wp-includes/user.php
Advertisement