Articles of wp user query

WP_User_Query orderby meta_val_num

I know that normal WP_Query’s can have an “orderby” parameter of “meta_value_num”, but when I try to user “orderby” => “meta_value_num” on a WP_User_Query, it doesn’t seem to work. Anyway I can obtain this functionality or is there something I’m missing? Edit: Here’s what I’ve tried to retrieve results ordered by numeric meta values: $sorted_users […]

custom post type 'pre__query' hook

When quering the wordpress users table, is it possible to use ‘pre_user_query’ to ammend the SQL query before execution against the database. Is there an equivalent hook method for each registered custom post type? I’m using the posts 2 posts to link two groups of custom post types. I want to include details of the […]

WP_User_Query Filter Results

I’m struggling to apply some filters to WP_User_Query, I have the following query, followed by some filters also shown, when I apply the filters they appear within the url structure, so /?gender=Male but I’m struggling to connect the filters to what is actually output, is there a simple method to take what I have and […]

How to put an array in wp user query

I am quite new to php and wordpress developement, and I am also new to this website. I want to learn development by trial and error. Please forgive me if i don’t use all proper terminology. I have some code that gets the following id’s for a user in buddypress. I would like to use […]

WP User Query get all authors with last name starting with specific letter

I need to program a page to which I pass an initial through the url and it will show all author users whose last name starts with that letter. I would like to do this via WP User Query so that I can easily loop over the results Right now I have this: <?php $letter […]

Change users.php WP_User_Query

A client has requested to have two kinds of custom user roles, and have those users displayed in an Admin Menu Page of its own. So far, I’ve achieved that using WP_List_Table with success. Now, the next request is to not display those users with those custom roles in users.php. So far, I haven’t been […]

WP User Query fails when searching meta queries and search columns

I’m building an advanced User search using WP_User_Query but experiencing some unusual behaviour. I’m trying to search with a term that I know exists in the user_nicename and user_email fields but fails to return when I include meta_query in the $args. Using the simple query below, when searching the users table data, WordPress returns everything […]

construct complex queries with WP User Query

Is it possible to create complex query with WP User Query ? With WP Meta Query, we can make complex queries with Nested arrays like : $meta_query_args = array( ‘relation’ => ‘OR’, // Optional, defaults to “AND” array( ‘key’ => ‘_my_custom_key’, ‘value’ => ‘Value I am looking for’, ‘compare’ => ‘=’ ), array( ‘relation’ => […]

How do I remove duplicate users from two merged WP_User_Query objects?

I’m trying to write a search that makes use of several custom user meta fields I’ve created, but was having a tough time implementing them. Basically having the same problem this guy was having, and I solved it similarly. $exclude = array( ‘1’ ); $args1 = array( ‘exclude’ => $exclude, ‘search’ => ‘*’ . $search_query […]

WP_User_Query and user posts

I queried a list of users using WP_User_Query from which I got the avatar, name and a few ACF that I created for the user registration. Now, I need to obtain a post list of each of the users in my results but I don’t know how to do it. This is my query WITHIN […]