Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [wp-user-query]

The tag has no usage guidance.

33 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
495 views

Wp_User_Query not sorting by meta key

I'm trying to list users sorted by a meta value. I store a score for each user in their user meta which is just a number but the loop isn't sorting. I include the score in the loop so that I can see ...
1
vote
0answers
80 views

WP_User_Query - searching multiple fields

I have a search engine where I can search for users on the front end. Profiles have mulitple custom fields. I'm just searching first and last name in this example. The problem is I can search for a ...
1
vote
0answers
23 views

What's the proper way to add users to my site in order to test things?

I'm new to wordpress. I'm have my site just running on localhost and want to test some things out with dummy data/made up users. When I log in to my wordpress database, I see that there is a table ...
1
vote
0answers
637 views

Is there a maximum limit of the number of users returns by WP_User_Query?

I’m working on a search form which filters the users . Everything works but the result is always limited to 299 users. Here is my code which is vers basic : $args = array( 'orderby' => '...
1
vote
0answers
159 views

Two queries for a WP_User_Query search work perfectly apart, but not together

I'm putting together a page that pulls User data and displays it in an attractive social-media-like format. I want to use a variable passed in through an input on the site to search multiple fields, ...
1
vote
0answers
117 views

Passing args to WP_User_Query am I using meta correctly?

I am hoping someone with more expertise can help me here. I tried passing specific args but the script wouldn't work as expected. Basically it lists all users who ticked a custom tick box that says ...
1
vote
0answers
556 views

WP_User_Query search with multiple search queries

Is it possible to perform a WP_User_Query with multiple search queries? Something like: $args = array ( 'search' => '*example.com OR *abc.com', 'search_columns' => array( 'user_email'...
1
vote
0answers
50 views

WP User Query Issues

I am trying to create a search of users to search for them using their first name, last name, billing phone, ID, or email. I have the following code written, but it does not pull in the correct data. ...
1
vote
0answers
45 views

Accessing current users data within a plugin

I have been working on a WordPress plugin for a couple of days, and I got it to the point where it works - I was however unhappy with the procedural code (I was rushing it for my site, to come back to ...
1
vote
2answers
48 views

Conditional IF statement not returning true even though echo of $user->province is correct

I am having a problem with an if statement which I have now tested many times over. $user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) ); if ( !empty( $user_query-&...
0
votes
0answers
22 views

WP_User_Query Orderby Not Working

If I use the following code, I can retrieve users in the correct order: $user_query = new WP_User_Query( array( 'role__in' => wp_parse_list( $atts['userrole'] ), 'meta_query' => ...
0
votes
1answer
34 views

Why get_users() not working on the admin backend?

I can't figure out why get_users() works on the frontend but not on the admin backend. I'm sure this was working at some point. My code: function add_new_user_menu_item() { remove_submenu_page('...
0
votes
0answers
36 views

WP_User_Query Search Multiple Keywords from a Multi-Select Field?

My code below works to list a single user when I ask to search for a single username; however, I am unable to list multiple users when asking to search for multiple usernames. Here is a brief ...
0
votes
0answers
87 views

Query users by custom field

I want to get the users who registered within last 7 days, and meanwhile who have uploaded custom avatar. I've added a function allowing users to upload their own avatar img with a custom field ...
0
votes
1answer
43 views

How to query 5 users in random who have published more than 10 posts

I want to display 5 users who have published more than 10 posts, when the page loaded again, it should show another 5 users or mixed with new users with more than 10 posts. How do I achieve this? ...
0
votes
0answers
30 views

unable to modify user table search results based on meta key

I would like to modify the pre_user-query wp_user_query to include a meta fields from the user meta. I have tried the two following methods, neither of which work (both return empty sets): $query-&...
0
votes
0answers
54 views

WP_User_Query not searching numbers?

I'm running this code: $users = new WP_User_Query( array( 'search' => '*63.19-4-00*', 'meta_query' => array( 'relation' => 'OR', array('key' => 'field_1'...
0
votes
1answer
192 views

Problem with WP_User_Query when 'meta_value' is an array

I have a problem with listing my users, who have a birthday today (for this instance today is March 3rd). I've created a custom field 'birth_date' using tutorial here with some minor tweaks. My ...
0
votes
1answer
605 views

WP User Query with meta queries

I'm having some problems when comparing integer values '>=' or '<=' with meta_queries with the WP_USER_QUERY. Let say I've stored the following meta keys with the meta values below: meta_key ...
0
votes
2answers
89 views

Why Am I getting an error when I add the number parameter to my WP_User_Query?

I have a custom WP_Users_Query that I have been using on a site. It has worked fine for a while. I went to add some pagination to the query using the number parameter as per the docs here. But for ...
0
votes
1answer
66 views

Loop 1 user randomly

At the moment I am using wp_user_query to loop users from a specific role(leden) on a webpage. For the overview page this is working fine, but on my homepage I want to feature one random user. I was ...
0
votes
1answer
431 views

How to order users alphabetically by name? in plugin UPME

I have this code: <?php class UPME_List_Cards { public $upme_options; public function __construct() { global $upme; add_shortcode('upme_latest_members_list', array($this,'...
0
votes
1answer
1k views

Wp_user_query search by meta_key not returning any results

I have a search form, and im trying to have it be able to search both the basic user field (user_email, display_name, etc), plus 1 other custom user meta key called "clinic" heres the argument i have ...
0
votes
1answer
509 views

WP_User_Query is Not Displaying Results

I'm trying to create a table with a list of users and it only seems to work when I have it set up like this: $user_report_query = new WP_User_Query( array( 'role' => 'Administrator' ) ); The ...
0
votes
1answer
211 views

How to order custom user list columns by datetime?

I am trying to add the ordering options to some custom user list columns I added in the Wordpress admin. This is my code : function mmm_user_sortable_columns_query( $userquery ){ if( 'test_date' ...
0
votes
0answers
866 views

How to get user by display_name with WP_User_Query

I'm using WP_User_Query to get user by display_name and other columns such as: user_login, user_nicename. Here is the code: $my_users = new WP_User_Query( array( 'role' =&...
0
votes
1answer
217 views

Search Functionality broken by the wp 4.2 update

I run a blog site with posts by authors, and I implemented a search that would return results if the search was like an author's name or the search term was contained in a story. I was functioning and ...
0
votes
2answers
757 views

WP_User_Query not returning users with meta - what am I missing?

I think I'm missing a step here, but for the life of me I can't see it. I'm trying to display a simple list of users who all have the same role and have the same meta data value for a certain key - ...
0
votes
1answer
254 views

How can I include user meta information in the resulting array of a WP_User_Query?

I'm trying to accomplish some fairly complex custom functionality on a custom WordPress site. The client has an 'About Us' page that includes a list of all team members and their pictures. We're ...
0
votes
0answers
328 views

Paginate Links not working

For the life of me I cannot get Paginate links to display pagination, but using 'userp' in the url works for paging. I just need the links to show up. <?php /** * @package WordPress * @...
0
votes
0answers
857 views

Sort users by custom user meta value

I'm trying to sort users by a custom meta value "user_business" which is their business name that way when users are listed they're sorted alphabetically by their business name as they should be. I'm ...
0
votes
1answer
601 views

Query Users by post count, last 30 days and display each users post count according to post type

I'm almost done, the code below does everything but display post count for each user broken down into post types, and also I'm like to filter it last thirty days. I'm trying to get the post for each ...
0
votes
1answer
93 views

How do I find users by password?

I need to add a passkey to each user, so I decided to just giving the user password that value and use WP functionality to store it/retrieve it. So now I need to find what user that password belongs ...