Title: WP_User_Query PHP
Last modified: February 2, 2017

---

# WP_User_Query PHP

 *  [1-jah](https://wordpress.org/support/users/1-jah/)
 * (@1-jah)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/wp_user_query-php-help-please/)
 * Good day, I dabble with php here and there, but I’m stuck. I want to make the
   query only contain the subscriber role and not sure how to write it. I have this
   to pull all role, obviously the default.
 *     ```
       // The Query
       		$user_query = new WP_User_Query( $args );
       	  	$total = $user_query->get_total();
       ```
   
 * Please let me know what I’m missing for the role filter and how to write it. 
   Thanks.

Viewing 1 replies (of 1 total)

 *  [montrealist](https://wordpress.org/support/users/spectrus/)
 * (@spectrus)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/wp_user_query-php-help-please/#post-8727769)
 * Is this what you want?
 * `$user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) );`
 * There are many examples here:
 * [https://codex.wordpress.org/Class_Reference/WP_User_Query](https://codex.wordpress.org/Class_Reference/WP_User_Query)

Viewing 1 replies (of 1 total)

The topic ‘WP_User_Query PHP’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [wp_user_query](https://wordpress.org/support/topic-tag/wp_user_query/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [montrealist](https://wordpress.org/support/users/spectrus/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/wp_user_query-php-help-please/#post-8727769)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
