Adding this as an answer here for reference for anyone searching for WP_User_Query stuff:
As per the docs The search
field on WP_User_Query
uses *
for wildcard text search, and will search on login
, nicename
, email
and URL
, unless specified otherwise.
E.g. to match any name containing bob
you need:
$args = array(
'search' => '*bob*'
);
$user_query = new WP_User_Query( $args );
Related Posts:
- Getting users by specific capability, not role
- How to activate the user search
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- Show only users with the same role in Dashboard user list
- Editor can create any new user except administrator
- How to allow an user role to create a new user under a role which lower than his level only?
- How to search for (partial match) display names of WordPress users?
- Remove Ability for Other Users to View Administrator in User List?
- Groups of capabilities: users with multiple roles?
- List users by last name in WP_User_Query
- Allowing users to edit only their page and nobody else’s
- alphabetically order role drop-down selection in dashboard
- How to let contributors to create a new revision(draft) editing their published posts
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- How to check user role without using current_user_can()
- Wp_User_Query not sorting by meta key
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- pre_user_query meta_query admin user list
- How to assign capabilities to user NOT to User Role
- How to stop a user from updating the post date
- include user profiles in search results?
- BuddyPress | Check if user is in current group [closed]
- Return ID of authors who have at least one post
- WordPress edit_user_profile_update update secondary role
- How do I properly format the user_role array?
- How-to Delay The Capability To Publish Posts?
- How to get the Role Name of the current user? (WordPress)
- Redirect after login based on user role (custom login page)
- set_role has no effect
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- Creating a Front-end based User Search
- Set default page for user account in admin
- Searchable meta value in user.php
- How to use search_columns in WP_User_Query?
- Tagging users in WordPress
- How do I list in the backend all users that were assigned to a custom role?
- How to query users who have empty first_name?
- WordPress User getting added with id of 0
- How to add local users to wordpress without email password?
- WP User Query fails when searching meta queries and search columns
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- add_cap not working with Shop Manager role
- Managing Users and Creating Groups [closed]
- Are User Levels Still Currently Used?
- Error: How to allow the “contributor” to upload media in wordpress
- WordPress API for search
- how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard
- Updating wp_user_level on user update
- Fix permissions for users role
- Find user by nicename and open profile
- How can I allow an User to publish only 5 posts per month?
- Extend backend User search to custom user meta
- Is possible to allow user to login with different role?
- Where are $current_user->allcaps set?
- How change user type from contributor to author
- How do I let contributors edit their posts after being approved once?
- Does wordpress support natively the concept of logging-in users? (not admins, but users of the website)
- is_user_logged_in() throwing undefined function error
- How many people are allowed to use same wordpress account at the same time?
- How to hide user profile fields based on the role of the viewed user?
- Fix ‘Add Role’ Option not there in wordpress 5.2.2
- Allow Users to Modify Some Values of Assigned WordPress Pods [closed]
- Can I Create a Second Admin Level User Role?
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to hide some users to unlogged users [closed]
- List all users and current week entries
- how do I add role and capability after I create a new user
- Get Authors Role
- WordPress user role with create user capability?
- Editor role can only create/edit/delete users who have one of two roles
- User can’t search himself on rest api
- Update user role for expired membership
- SQL to set Display Name to First Name + Last Name
- Cannot update newly added User field using wp_update_user
- Getting user data via ajax
- Hook into add_user_role and update based on new and removed roles
- How to Moderate Edits to User Profiles?
- members only products
- fine-grained capabilities for user related capabilities
- Create relationships between users or user roles
- Disabling user capability to edit_posts or delete_posts in the front-end
- Updated user role inncorrect when using wp_get_current_user()
- User Permissions on custom post type
- Custom User Role: Can Edit Own Page, Cannot Create New
- Show user details only
- WordPress install checking permissions of user id 0
- How to do a search based on the user’s location & search term and return proximity-based results?
- Access level seems to have gone from admin to editor
- Front end login and page restriction
- Limit roles displayed in users.php depending on custom role
- Creating Custom user type just like custom post
- Sort users by custom user meta value
- Control Category of each user can post
- i need to let a user to add a role from a frontend form
- Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
- WordPress: New user role which is ONLY allowed to manage media