Fastforward to WordPress 4.4 – it will support the role__in
attribute!
It looks like WordPress 4.4 is our lucky version number, because it will support both the role__in
and role__not_in
attributes of the WP_User_Query
class.
So to include the subscriber, contributor and author roles, we can simply use:
$users = get_users( [ 'role__in' => [ 'subscriber', 'subscriber', 'author' ] ] );
Check out the ticket #22212 for the whole story!
Related Posts:
- Editor can create any new user except administrator
- How to set up User email verification after Signup?
- Allow up to 5 Concurrent Login Sessions
- Show admin bar only for some USERS roles
- How can I get users email (and additional data) from the rest API?
- How to hide “Filter user list” from “All Users” screen
- How to create a template for a custom URI associated with the user
- How to check user role without using current_user_can()
- How to assign capabilities to user NOT to User Role
- Setting WP Admin passwords to expire
- How do i auto approve new user?
- BuddyPress | Check if user is in current group [closed]
- Pre-populate Username Field
- Redirect after User Activation [closed]
- Getting users who registered 360 days from current date
- Querying Email Addresses for a List of Users with Same Last Name?
- How to keep track of user logins?
- Mass delete spam accounts
- Get all commenters on a post
- WP_User->add_role producing unexpected results
- Adding tags and inputs to a user’s profile
- Changing default Buddypress avatar affects all site avatars (because gravatar)
- Custom style on profile options page
- Best way to have an per-user customized private section
- How to query users who have empty first_name?
- How to make user accept license agreement before download
- Does wp_delete_user() remove all user content?
- 14,000 WordPress Users. How did they get there?
- Adding second Email address for WP user notifications
- wp_login_form() passing user ID into URL on redirect?
- how to make a profile entry read only except for site managers [closed]
- Managing Users and Creating Groups [closed]
- Upgrade Nightmare – No Posts, Permissions Issues and Can’t Create a new post
- Max no of simultaneous active sessions for a single user
- WPML Default Language User Meta [closed]
- Favorite taxonomy archive page?
- Removing all trace of member profiles
- WordPress API for search
- Fix permissions for users role
- Redirect subscribers to last viewed page after log-in
- User Meta Data in a Sortable Table
- Are there mutiple ways to get usernames (as a hacker)
- Rest api return all users (even without content) to all users
- Column Sorting Code on users.php
- How can I allow an User to publish only 5 posts per month?
- search users using user name and user meta in wordpress
- Where are $current_user->allcaps set?
- How to activate the user search
- WordPress Login Customization for External Authentication
- How to allow registered users to submit the form only 5 times per day?
- Is there any action /filter hook I can use to disable login for some user role?
- Create a “user log”
- WP_User_Query combining role and ids
- WordPress current month users
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Can I Create a Second Admin Level User Role?
- Custom registration and pending approval
- Let logged-in users use radio buttons (yes and no) to exclude their author profile from the user listing
- Make new users automatically approved
- Adding fields to the “Add New User” but the form data not saved into DB
- Admin approval for editing user profile
- Using a custom field value as current users name [closed]
- How would I restrict certain user levels from editing categories
- How can I set wp_dropdown_users so that it shows only authors?
- What does “link” refer to when you delete a user?
- WP Create User – Preventing repeated information
- Editor role can only create/edit/delete users who have one of two roles
- Can’t add user- wrong message “this user name is invalid because it uses illegal characters”
- set automatically email address for WordPress users
- WordPress 5.8 – Hide or Remove personal fields from admin Profile page
- hide user is currently editing warning in admin post page
- change user password REST API
- Use WP cookie to authentificate user on an external app
- Append USER ID to an outbound link?
- How do I add profile fields in specific section?
- fine-grained capabilities for user related capabilities
- Users activity history
- How to destroy all user sessions via WP-CLI
- Is a list of user names or IDs in a custom profile field the best way to create a followers list?
- Custom User Role: Can Edit Own Page, Cannot Create New
- How to restrict Admin from creating new users from Add new user screen in dashboard to only of one domain?
- Get meta key with value for user
- Redirect current user
- Display Users and user url’s
- custom login form, guide me
- Edit dashboard based on user ID
- is_user_logged_in() not working after domain change
- Get the author registration date in the header.php file
- Front end login and page restriction
- How i will get the images of highest scored users?
- Designing a member area on my site
- Link to Authors blog posts
- Redirect based on log-in status per JavaScript
- i need to let a user to add a role from a frontend form
- Integrating Facebook Registration (and Login) on a WordPress page
- WordPress C# User Login
- Why does a super admin on multi site get a rest_user_invalid_id error code when requesting user details through REST?
- How to allow users to make quizzes or tests in WordPress?
- Sorting Users page admin column with ACF field
- Can we get user profile page using user_id in the URL?