Actually, rand
is not a valid argument for orderby
in the WP_User_Query class (it is in the WP-Query class). So, it should default to user_login
, giving you an alphabetical list. Also, you should get all users that fit the member
and exclude
criteria from this query, not just eight.
This suggests there is other code interfering with yours.
My suggestion would be to start with adding 'number' => 100
to $args
. That should overrule any other code limiting the amount of results. You could then use shuffle
to randomize the array returned or pick some random elements from the array with array_rand
.
Related Posts:
- Getting all user metadata from user
- How to add custom query filters in WP_User_Query
- WP User Query get all authors with last name starting with specific letter
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- How to query 5 users in random who have published more than 10 posts
- Query Users by post count, last 30 days and display each users post count according to post type
- Searching user meta using WP_User_Query
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- SQL User Query by Multiple Roles using PHP
- WP_User_Query unable to retreive all user at once
- Sort users by “birthday” using WP_User_Query
- Hide Administrators From User List except current user (administrator)
- WordPress search posts by author name with autocomplete
- pagination with numbers for WP_User_Query
- How to display user order by role
- Import wp users via one click demo option
- Dynamic User Id
- Get users that likes the post
- Prevent author bio page from showing in search results
- Get multiple users with meta value in one query and populate WP_User class
- Display if author page is author page of current user
- array of meta values using WP_User_Query
- Get user first name from custom endpoint
- How to properly use AND / OR in custom search
- WP_User_Query and user posts
- construct complex queries with WP User Query
- Storing an array of objects related to each user
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- WP_User_Query orderby meta_val_num
- Query to get last posts from authors of blog
- Replace wp_query with wp_user_query
- Query pages created by deleted users
- Query posts by post type, author and post meta
- SQL to join u3g_users & u3g_meta_value with repeating data
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- WP_User_Query Orderby Not Working
- Set “editor” role to existing user
- How to query users by post count no less than 10
- Merge wp-query and get_users
- Get all wp_users sort by metakey
- Logging search queries for logged-in users
- WP_User_Query not searching numbers?
- List users by Year of Birth using a foreach loop to dynamically populate years and data
- Show subscriber id in loop
- Search Functionality broken by the wp 4.2 update
- Get users query makes the site loading time too big?
- Get all user with both meta_value
- WordPress WP_User_Query ignores the `meta_query` when called from an Ajax function
- Orderby meta _value that is saved as an array
- Group users by meta field, with name of meta field as group title
- Complicated `orderby` based on text in custom field
- Using a Query Loop Block with Variables (Custom Meta)
- How to remove “MY WORDPRESS”” Label
- Counting instances of words in the results of a post query
- Search filter between promo and exact price
- query hook parse_tax_query function takes no effect
- Order post by modified date
- meta_query with meta values as serialize arrays
- Is it possible to give a classname to specific comments in the WordPress admin?
- Populate select list with meta values from all posts of a Custom Post Type
- pre_get_posts pagination not working
- Prevent Duplicate Post Counted by Query
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- tax_query not working on custom post type
- Filter for each loop when WP_Query has no posts to show
- Save queried result into database
- Show child by slug, while knowing parent ID
- sanitize_post() is not sanitizing Post Object
- Form checkbox value going to dynamic URL
- get_post_format is not returning standard
- Duplice post with standard WP loop – fixed by using query_posts() instead
- How to use the Term Object from a custom select field in a query
- ElasticPress is (aparently) messing with my search filters
- get_posts function not returning any results
- how to include orderby value that is empty?
- Why last row deleted when refresh page
- meta_query – check for multiple meta values in key which holds an array of values
- SQL to set Display Name to First Name + Last Name
- Custom Taxonomy – Modify Function to Get Child Category
- How to sort wordpress posts already selected by WP_QUERY
- WP Query – grouping posts by same meta key, adding together values from another key
- Pagination repeating posts on search results
- I have problems with the search query using multiple post types
- setting offset to category number in archive page
- Woocommerce Get Orders By Meta Value
- Retrieve all custom field values of a specific custom field metakey as an array, inside WP_Query
- Cannot update newly added User field using wp_update_user
- Pagination not working on archive.php template?
- WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination
- Save large WP_Query to transient === false
- How to grab data after wp user search is complete
- WP_Query breaking the loop in a nested loop
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- 3 posts from each existing category on one page
- WordPress Query for CPT that only shows posts within radius of current user’s geolocation
- Sort by price wpdb
- WP_Query for a taxonomy value OR a custom post type meta field
- How to make WPQuery custom post type work in Twig / Timber
- Meta query ignores multiple values of the key