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
- Find out total number of pages in global query on archive page?
- Resetting post data to previous loop in nested loops
- List users by last name in WP_User_Query
- Is it possible to completely stop WP_Query retrieving posts?
- Pagination returns 404 after page 20
- Make a WP Query search match exactly the search term
- Make loop display posts by alphabetical order
- Displaying several specific pages using WP_Query()
- WP-CLI How to generate a list of posts with corresponding meta values
- Query to return maximum of one post per author
- Warning: urlencode() expects parameter 1 to be string, array given
- All sticky posts are returned in custom query
- Get attached media only
- Can not switch the queried post in pre_get_posts hook
- Why use JSON API to display recent posts?
- Pagination problem after WP_Query with tag filtering
- Get list of terms that have posts in another term
- Custom query for sidebar isn’t returning results
- How to vary post loop results layout and resume?
- Adding an array from a query string to a WP meta_query
- WordPress add_rewrite_rule() cannot visit lower url levels
- Using Advanced Custom Field for file upload, how do I load the file url
- Retrieve posts using thumbnail id as meta key
- Modify Search Query if original Query gave no results
- How to cache wp_query with pagination using transients?
- Problem with WP_query
- Why is WP_Query not displaying expected data?
- Filter post query to only show direct children of category
- has_excerpt() not working inside wp_query
- Get every post with value in meta key
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- How to get posts by category and by choosing a taxonomy term?
- Paginate pages with dynamic query
- WP_Query loop doen’t work with my custom taxonomy
- Deleting terms from the WordPress wp terms table
- In a WP_Query can I force the results’ is_singular() to be set to false?
- Order (by ASC) posts with meta_key so posts without values are last
- WordPress Query optimaization for slow query
- WordPress – just refresh blog archive by new query
- how to move a page from one drop down menu to another drop down menu
- How to pass a php variable to js within a template?
- Meta query doesn’t remove placeholder escape before query
- Multiple values in WP_Query : category__and
- Custom query: post__in parameter causes query to be empty
- WP_Query using meta_query with LIKE doesn’t return what it should
- How to organize a WP_Query’s list of posts by category and display category title?
- How to Query Updated Post in WordPress
- wordpress nested loop
- Query_vars not working for me
- Query posts only shows 1
- How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?