get_users

Retrieve list of users matching criteria.

Description

(array) get_users( (array) $args = array() ); 

Returns (array)

List of users.

Parameters (1)

0. $args — Optional. (array) => array()
Arguments to retrieve users. See WP_User_Query::prepare_query(). for more information on accepted arguments.

Usage

  1. if ( !function_exists( 'get_users' ) ) { 
  2. require_once ABSPATH . WPINC . '/user.php'; 
  3.  
  4. // Optional. Arguments to retrieve users. See WP_User_Query::prepare_query(). 
  5. // for more information on accepted arguments. 
  6. $args = array(); 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = get_users($args); 
  10.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/user.php  
  1. function get_users( $args = array() ) { 
  2.  
  3. $args = wp_parse_args( $args ); 
  4. $args['count_total'] = false; 
  5.  
  6. $user_search = new WP_User_Query($args); 
  7.  
  8. return (array) $user_search->get_results();