Skip to main content

Questions tagged [wp-user-query]

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

WP_User_Query get_count issue with meta_query relation

I'm using WP_User_Query to count the total number of users based on specific criteria. Generally, the following code works well: $args = [/* your arguments here */]; $query = new WP_User_Query($args); ...
RafaSashi's user avatar
  • 487
0 votes
1 answer
25 views

Email Customization - Can't get user_activationo_key

I hope someone can help or had the same problem, because I don't know how to get to a solution. I am trying to customize the registration email of new users, where the password set link is. For the ...
Markus Pfister's user avatar
0 votes
1 answer
23 views

wp_user_meta doesn't return data in a foreach loop

I am attempting to get meta data in a list of WP users using this code, but am unable to retrieve the meta data: $args = array( 'meta_key' => 'last_name', 'orderby' => 'meta_value', '...
zeldatron's user avatar
0 votes
1 answer
26 views

User Export Function Missing

I am trying to export my Users on Wordpress and I don't see the "Export" function under "Bulk Actions"
Jose's user avatar
  • 1
0 votes
1 answer
32 views

Orderby meta _value that is saved as an array

I want to order a WP_User_Query by a meta value. The meta key is a multi-select field, and the value is saved as an array. When I do a print_r of get_user_meta($user_id,'committee',true) this is what ...
LBF's user avatar
  • 529
0 votes
1 answer
49 views

Sort users in admin screen by meta value whether it exists or not

I want to list all users and order them by a meta value. Several users have it and some do not, but I want to be able to list them all and group them accordingly. I have the following code but it only ...
Badger's user avatar
  • 193
0 votes
1 answer
54 views

Cannot get user's ACF data when using a template part in a WP_User_Query

I'm using a template part to repeat the HTML for each result when performing a WP_User_Query to return a list of users. However I am finding that the Advanced Custom Fields data isn't returning. // ...
greatsplott's user avatar
0 votes
2 answers
13 views

Transform user name before displaying

Users are created whith name in upper case on my site, but some admin want to display it in lower case. I had a custom field in user profile to identified those admin, but I don't know what hook I can ...
Jean-Christophe Barrez's user avatar
0 votes
1 answer
54 views

Complicated `orderby` based on text in custom field

I'm doing a user query and looking to query users that are in a certain department (custom field) -- this works. Now I'm trying to manipulate the order....I'd like to use the meta_key for position and ...
NW Tech's user avatar
  • 707
2 votes
1 answer
249 views

Query a meta key using an array of values where the database value is a string

If a meta value in the WordPress user_meta table is set as a comma separated list and not a serialized array, how can we compare an array of possible values to the values in the database table? ...
armadadrive's user avatar
0 votes
2 answers
125 views

User Query Multiple Orderby Clause

I'm having trouble getting consistent results from a WP_User_Query when ordering by multiple meta values. There is a meta field that contains a serialized list of IDs, and I need to display users with ...
davvcarpenter's user avatar
-1 votes
1 answer
140 views

wp_mail function not working in user query loop

I'm trying to send an e-mail to every user who is logged in more than a year ago (based on woocommerce meta value from database), but the e-mails do not go out. In my code I'm trying to filter myself ...
Attila Sotus's user avatar
0 votes
1 answer
696 views

Extend user search in the Wp backend area on the users.php page to allow for searching by email domain and role from the "users search" input box

I have been looking to extend the ability to search users in the backend for some time and have tried variations of several functions recommended in these articles and posts along with others not ...
Johnathan's user avatar
0 votes
0 answers
37 views

Show only users with the same role in Dashboard user list

I'm trying to see in the dashboard user list only the users with the same role of the logged in user. For example, i have Admin, Mod and Subscribers roles, when I'm a Subscriber i want to show only ...
Alex's user avatar
  • 1
0 votes
2 answers
108 views

Unable to do WP_User_Query with meta filter

I have a user base of hundreds of users, and trying to create a custom API endpoint to get users in a specific membership group. The database structure is as follows (using Ultimate Member plugin): ...
harmjanr's user avatar
  • 109
0 votes
0 answers
26 views

User with same Mail but a different additional info(like domain)

I know this is not the way u should go, but my customers want it so im looking for ways. Requirement: WP with one DB (3 Domains sale the same stuff) 3 Domains which use this DB (can be more later), ...
StefanBD's user avatar
  • 111
1 vote
0 answers
363 views

Parent User and Child User - relate users

I need to create a system in which I have 2 types of users: Company User (C) and Employee User (E). I need C to be able to register as many E as necessary and for C users to be able to publish ...
naber brene's user avatar
0 votes
1 answer
198 views

Replace wp_query with wp_user_query

I'm turning out some subscriber archives and singles (profile pages) in my plugin where I'd also included a 'user-single' template, included via template_include. I'm experimenting however with ...
Kevin Nugent's user avatar
0 votes
1 answer
1k views

User query - getting values for custom meta keys/fields

I am beginner at customizing wordpress but have some experience in PHP coding. I'm struggling to figure out how to display all existing meta keys (custom fields defined by ACF) for all users that have ...
Vesna Mačković's user avatar
0 votes
0 answers
146 views

Getting current user data with MySQL statement

There are many widgets in Elementor which allow using MySQL statements to populate some data field. What I am trying to do is populate a field with a specific user's order data. The problem I am ...
thisissparzo's user avatar
0 votes
1 answer
201 views

How do I echo all users' display_name and their meta_value who have a certain meta_key?

I have a meta_key inside the table usermeta called 'sms_subscriber'. The meta_value for it is their phone number. I want to echo a list of all users who have that field; in other words, a list of each ...
Ben Blue's user avatar
  • 117
0 votes
0 answers
97 views

Wrong result in fetching User meta of WordPress

I have custom post type Task where I assigned Users as Volunteers. Now I would like to fetch how many tasks assigned to a Volunteer. I am using below code. $users = new WP_User_Query(array( '...
Foysal's user avatar
  • 445
0 votes
0 answers
24 views

How to query users to count all with a custom capability and limit it to a set of roles?

On a site with 12 custom user roles I need to count users with the 'supervisor' custom capability but limited to four specific roles. The following code counts all users with the 'supervisor' ...
AJD's user avatar
  • 349
1 vote
1 answer
366 views

WP_User_Query ignoring 'meta_query' arguments

So, I'm trying to do a query on 'members' based on some inputs from a form using AJAX. The thing is that when searching for a 'role' I get the expected result. But once I try to look for other meta ...
Marcelo Henriques Cortez's user avatar
0 votes
1 answer
169 views

last_name + first_name orderby with meta_query [solved]

I have small issue with orderby. I´m looking solution to orderby ASC (lastname + firstname) example: Selanne Andy Selanne Beeny Selanne Teemu But now it arrays something like this: Selanne Beeny ...
MSI's user avatar
  • 3
0 votes
1 answer
972 views

Dokan Marketplace store link in single product page

I use this this way to display product store link with [vendor_shop_name] shortcode in custom product page. /*Shortcode [vendor_shop_name] https://stackoverflow.com/questions/55364574/display-dokan-...
Teymur Abbasov's user avatar
0 votes
0 answers
32 views

Issue with user meta_query

I am creating a zip code radius search. I am pulling the all the zip codes within a radius depending on the search term through an API, then doing a user query to compare a custom meta field that has ...
Travis Kline's user avatar
0 votes
1 answer
182 views

Get a Post Loop based on Logged in User information into a Shortcode

I have a follower button on users profiles where users can follow other users. I have a page template that shows all posts by users the currently logged in user follows. I would like to create a ...
RobH's user avatar
  • 7
0 votes
1 answer
523 views

array of meta values using WP_User_Query

I don't see that it is possible when I look at the WordPress documentation but I wanted to confirm. I want to check multiple meta values against one meta key eg: $user_query = new WP_User_Query( array(...
user8463989's user avatar
1 vote
1 answer
527 views

Wordpress search posts by author name with autocomplete

I am using autocomplete code as follows: functions.php // add the ajax fetch js add_action( 'wp_footer', 'ajax_fetch' ); function ajax_fetch() { ?> <script type="text/javascript"> ...
mrmotivator's user avatar
2 votes
1 answer
64 views

Echo the number of users using WP_User_Query?

Ok, so right now I can easily echo the number of posts that has a specific meta_key and meta_value: $query = new WP_Query( array( 'meta_key' => 'usp-custom-1', 'meta_value' =&...
robert0's user avatar
  • 203
0 votes
0 answers
51 views

Link multiple user databases together?

Okay, so I am helping in website design and social media aspect of a game my friends are developing, and I want to be able to sync my Wordpress user database, game wiki user db and the game's database....
Ron's user avatar
  • 1
0 votes
0 answers
174 views

How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?

I am looking for some assistance with how I can filter AND/OR sort my WP query while on a taxonomy page. Essentially, what I am looking to do is have all users listed in alphabetical order on the ...
The9mm's user avatar
  • 33
0 votes
0 answers
622 views

Query users and count totals based on meta values

Users can choose a value from a multiple choice checkbox on sign up. In this example the choices are Cat or Dog. I have a WP User Query and want to count the amount of users that have each meta value, ...
user144271's user avatar
1 vote
1 answer
201 views

How to combine two get_users() array?

The $q1 and $q2 are working well individually. if (!empty($search_term)) { $q1 = get_users(array( 'fields' => 'all', 'role' => 'contact', 'search' =&...
Ashif's user avatar
  • 13
0 votes
2 answers
216 views

Can you return users of a higher role than the current user using get_users()?

I am using get_users() to return a list of users with specified roles. The purpose of this is to generate a dropdown on the front end to mention other users in comments, very similar to the ...
Kyle Dearle's user avatar
0 votes
0 answers
71 views

Compare time value in WP_User_Query for sending emails

I am trying to setup a custom plugin that will compare the time (last activity of a user) and send emails to them. I am using the below WP_User_Query and a cron job function reminder_email() { // Get ...
Honoluluman's user avatar
0 votes
0 answers
75 views

How to optimize the opening speed of admin panel?

Now my access to the WordPress post editing page is abnormally slow and I have to wait 30 seconds or more for it to finish loading each time. Initially, I thought it was a problem with the network ...
Matthew's user avatar
  • 151
0 votes
1 answer
133 views

Random users always showing same 8 users

I am trying to display some random users on the page. It is changing the order of the users it is showing, but it is only showing the same users instead of randomizing from all users in the database. ...
user8463989's user avatar
1 vote
0 answers
286 views

Four columns in the wp_users table

I am writing custom code to allow users of my site delete their own accounts from the front-end (i.e., they do not have to logon to the WordPress admin area to perform certain actions, but rather I ...
Greeso's user avatar
  • 2,184
0 votes
1 answer
951 views

Display the list of user's comments + the post title + date

I am trying to display the current user's ALL comments in a specific page and I'm using this code (uses a shortcode): https://blog.ashfame.com/2011/01/show-recent-comments-particular-user-wordpress/ ...
cloyd concepcion's user avatar
0 votes
1 answer
1k views

SQL to set Display Name to First Name + Last Name

I'm trying to set the wp_users.display_name for a rather larger users db using SQL query. Got till this point: SELECT x.display_name, x.first_name, x.last_name FROM (SELECT u.display_name, f....
Nitin Nain's user avatar
1 vote
0 answers
17 views

User Query sort on custom field then name

I am trying to sort a list of attorneys (set up as Users) classified as founding members, members, and associates. Those classifications are stored in the attorney_title meta field. I need them to ...
nickfindley's user avatar
0 votes
0 answers
299 views

Cannot update newly added User field using wp_update_user

I want to add a new attribute to the wp_user table, "twitter_id" for example. I added the new column to the wp_user table, and it is added correctly. I get the current user (as I want to ...
DjangoBlockchain's user avatar
0 votes
0 answers
129 views

How to grab data after wp user search is complete

In the wp backend wp-admin > users.php there is a search field which we can use to search for particular users. Let's say we search for a string 'test' and it retrieves 3 users. How can we grab the ...
bakar's user avatar
  • 101
1 vote
0 answers
26 views

how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard

I want to display for the admin when a user visits a page and when he leaves that page the page is for example test.test/my-dashboard. and it's only available for the logged in users. the admin knows ...
abdelouahed ait ali's user avatar
0 votes
2 answers
2k views

I imported an restore an database and It shows #1067 - Invalid default value for 'user_registered'

My database tables become corrupted so for fixing them I restored data and It shows an error #1067 - Invalid default value for 'user_registered' how can I fix it.
Sachin's user avatar
  • 41
0 votes
0 answers
25 views

SQL to join u3g_users & u3g_meta_value with repeating data

I'm using the below SQL to create a table from wordpress user information joining data in u3g_users and u3g_metavalue. SELECT u3g_users.`ID`, u3g_users.`display_name` AS `Name`, ...
Dan Hardy's user avatar
1 vote
0 answers
105 views

How to show user online status on their posts?

I've tried a lot to solve this but of no use. I have a classified wordpress website where users can post their ads. I want to show their online status on the ad they post (archive and single posts as ...
Fatimah's user avatar
  • 11
0 votes
1 answer
238 views

Getting user data via ajax

I am trying to list registered users on the frontend which have a role of 'member'. I have a lot of advanced custom fields for the users though and don't know how to get those fields. I installed the '...
user8463989's user avatar