Title: Select multiple roles in users loop
Last modified: August 31, 2016

---

# Select multiple roles in users loop

 *  Resolved [Peter Berger](https://wordpress.org/support/users/peterpolow/)
 * (@peterpolow)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/select-multiple-roles-in-users-loop/)
 * Hi Eliot,
 * I’m trying to display the names of users with different roles in one loop. For
   example: I want to display the users with the role admin or author.
 * A loop for just one role works fine (also with a custom role created with the
   Members plugin from Justin).
 *     ```
       [users role=admin]
       [user nickname]
       [/users]
       ```
   
 * But this doesn’t work:
 *     ```
       [users role=admin,author]
       [user nickname]
       [/users]
       ```
   
 * I get it done with the code below (because the roles of the users I want to display
   has the capability “upload_files” in common).
 *     ```
       [users exclude=5,8]
       [is capable=upload_files]
       [user nickname]
       [/is]
       [/users]
       ```
   
 * But it would be nice if I can select multiple roles in one user loop.
    Is it 
   easy for you to make this possible?
 * Thanks (again, again and again) in advance!
 * Peter
 * [https://wordpress.org/plugins/custom-content-shortcode/](https://wordpress.org/plugins/custom-content-shortcode/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/select-multiple-roles-in-users-loop/#post-7134310)
 * Hi Peter,
 * Sorry for the late response, and thank you for pitching in to help some people
   on the support forum. I was caught up in some busy-ness the last few weeks, but
   I’m back.
 * In the latest plugin update, I added support for querying multiple user roles.
   Apparently WP_Query doesn’t support it, so the users loop performs query for 
   each role, then combines the result.
 *  Thread Starter [Peter Berger](https://wordpress.org/support/users/peterpolow/)
 * (@peterpolow)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/select-multiple-roles-in-users-loop/#post-7134311)
 * Nice work (as usual). I tested it and it works as expected. Thanks a lot!
 * Please, don’t say sorry. I don’t expect you to response quick. I appreciate any
   effort you provide to the plugin.
 * Peter

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Select multiple roles in users loop’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

## Tags

 * [different](https://wordpress.org/support/topic-tag/different/)
 * [list](https://wordpress.org/support/topic-tag/list/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [user](https://wordpress.org/support/topic-tag/user/)

 * 2 replies
 * 2 participants
 * Last reply from: [Peter Berger](https://wordpress.org/support/users/peterpolow/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/select-multiple-roles-in-users-loop/#post-7134311)
 * Status: resolved