WordPress | count_users Function

The count_users() function will count the number of users who have each of the user roles in your WordPress.

Below is the syntax of count_users () Function, how to use in your WordPress plugin or theme file.


Used Parameters:

$strategy :(string) (Optional) The computational strategy to use when counting the users. Accepts either ‘time’ or ‘memory’. Default value: ‘time’

$site_id : (int|null) (Optional) The site ID to count users for. Defaults to the current site. Default value: null

Below is an exaple of count_user() funtion hot to use in your code.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.