Questions tagged [wp-user-query]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
31 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
1answer
33 views

Normal PHP array for exclude section of WordPress query?

I just wanted to check on something with the community here and avoid any future drama. I have a variable which seems to be working fine in a wp_user_query but not sure if I'm missing something that ...
1
vote
1answer
12 views

Showing all users who match 2 meta fields with current user

PHP novice here... so thanks for your patience and generous answers in advance. I'm trying to show a list of all users who match two fields with the current user, but it's not working so I would ...
0
votes
1answer
55 views

WP CLI - show users whose ID is larger than given ID

The below code achieves what i need for given ID = 200. wp user list --role='customer' --orderby=ID --order=asc | awk 'FNR == 1 {next} $1>200 {print ;}' How to do it with wp user list and WP ...
0
votes
0answers
54 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
33 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
1answer
24 views

How to get the count

How to get the count of the WP_User_Query result while I use $query = new WP_User_Query( $args ); echo count($query); It returns 1 when there is no user. But I need 0 in that case. How can I get ...
1
vote
0answers
51 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 ...
0
votes
1answer
81 views

WP_User_Query with 2 sets of conditions 'AND'

I would like to write some arguments for my query and both need to be true. I am having trouble with the Syntax. 'meta_key' => $campaign_type, 'meta_value' => $Campaign_ID, AND 'meta_key' => '...
0
votes
1answer
28 views

Periodically Query an external API on wordpress site

I am creating a wordpress site that will periodically retrieve data from an API and use that data to update info in the wp_users table. I don't really know how to go about this. I'll start with 2 ...
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 ...
2
votes
1answer
28 views

User Relationship

I have created a custom registration page, whereby a person will receive a code from another user and type in a code upon registering. If the code matches, i need the user who has just registered to ...
1
vote
1answer
38 views

Upload Video and preview

I have a question about videos in WordPress. Is it possible to let my users upload videos and show the preview in their profiles? Not have a video post page, just the user can see a preview in low ...
0
votes
1answer
39 views

How can I prevent certain custom roles from seeing other custom roles on the user list page?

So I am building a system with 3 different custom roles - Admins, Providers, and Users. Providers have access to users.php, or the list users page. However, they should not be able to see/edit/access ...
6
votes
2answers
316 views

Single loop for wp_query and wp_user_query

First of all, I tried searching and working on this, but couldn't create the logic or method to do this. I'm trying to display users and custom post type content together into a single loop. I can ...
0
votes
1answer
46 views

Get users between user ids

How select users between 100 and 200 user ID's? Or select users which ID less then 200? $args = array ( 'query' => array( array( 'key' => 'ID', 'value' ...
1
vote
2answers
106 views

Modify user table search results

Hi i am using the following to modify the results returned from a search on the users tables in wp admin : add_action('pre_get_users','custom_user_search'); $query->query_vars['meta_query'] = ...
0
votes
0answers
28 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-&...
3
votes
2answers
387 views

Check if WP_User_Query 'include' is empty

This is my code: $args = array ( 'order' => 'DESC', 'include' => get_user_meta($author->ID, 'the_following_users', true) ); $wp_user_query = new WP_User_Query( $args ); $...
1
vote
1answer
35 views

Get users that likes the post

I have an ajax like posts system when a user like a post the system added a post meta to the post and it's named (post_liked_users). Example of post_likes_users meta value: a:1:{s:6:"user-1";i:1;} ...
1
vote
1answer
88 views

WP_User_Query not displaying any user [closed]

I dont understand what is wrong my code is just not working, I have tried with different $args but still no user displays. Following is my code: $args = array( 'role__in' => array('Subcriber',...
0
votes
2answers
1k views

WP_User_Query unable to retreive all user at once

I have more than 3000 users with role 'subscriber', and now i want to fetch all users with role 'subscriber'. $user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) ); $users = $...
0
votes
0answers
48 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
55 views

WP_User_Query counter not updating with pagination

Below is the code that I found (thanks to The_Sumo) on this link and the code works like a charm. I am trying to add an additional column to the table that displays the ordered list number of the ...
0
votes
1answer
54 views

creating new field on mysql

I would like to add extra sections like "gender" on the WordPress user database. I would like to draw information from this information later. For example, let's say I want to attract gender. I ...
1
vote
2answers
1k views

Wordpress User getting added with id of 0

Am adding users in the backend and have taken site from live environment and put into localhost (development environment), but I have noticed a few things on localhost (not sure if these problems also ...
0
votes
2answers
558 views

Add Watermark to PDF's of logged in user in WordPress upon upload to media library [closed]

How can I add a watermark to my PDFs that are uploaded via the media library of the logged in WordPress User when viewing and printing the pdf. I have tried utilizing plugins but they are all limited ...
0
votes
1answer
159 views

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 ...
1
vote
2answers
774 views

How to query users who have empty first_name?

So far I have tried these three options and all 3 of them are not working. Option 1 $options = array( 'meta_key' => 'first_name', 'meta_value' => '', 'meta_compare' => '=',...
0
votes
1answer
182 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 ...
2
votes
1answer
94 views

Users instead of posts: How to modify the main query?

I'm trying to create an archive of users. My first thought was to use WP_User_Query inside a page to create a secondary loop. $wp_user_query = new WP_User_Query( $args ); // Loop here. This ...
2
votes
1answer
369 views

How to display next and prev pagination links with WP_User_Query?

Looking through the pagination functions available in WordPress, most seem to be associated with posts. paginate_links() seems to be the only function which will work with WP_User_Query. However, when ...
1
vote
0answers
536 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' => '...
0
votes
1answer
95 views

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,...
1
vote
1answer
62 views

WP_Query ordered by meta_value_num doesn't fetch posts without this meta field

I have a custom user query, which should order users by a custom meta field staff_profile_position. Users, who don't have a staff_profile_position are not fetched with this query: $args = array( '...
1
vote
3answers
1k views

Pagination not working on custom query

I am trying to change pages when I search by category on my website. When I am not searching under a certain category I can switch pages fine but when I am searching for a category I am unable to ...
0
votes
1answer
203 views

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 ...
1
vote
0answers
137 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
107 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
1answer
1k views

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 ...
0
votes
1answer
521 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
79 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 ...
1
vote
2answers
2k views

Get users in query and limit user output to five in random order

In the footer.php I show all the authors of my blog with the following code: $args = array( 'meta_key' => 'last_name', 'orderby' => 'meta_value', 'order' => 'ASC' ); // Create ...
4
votes
2answers
30k views

how to get list of all users and their metadata

How do I get a list of all users with role = 'Customers' including all the metadata per user, means wp_users + wp_usermeta. Query below does not generate the wanted results. $query = "SELECT * ...
0
votes
2answers
464 views

Get Sticky User in user loop based on user role

I have this shortcode to display a loop of user avatars with order by registration date. function Profiles() { $args = array( 'orderby' => 'registered', 'order' => 'DESC', '...
0
votes
1answer
747 views

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 ...
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
388 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,'...
1
vote
0answers
527 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'...
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 ...