Questions tagged [wp-user-query]

The tag has no usage guidance.

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

WordPress get last inserted user id

I want to disable user_login field into my CMS. They are register only their email adress. I think to create secret user login by programmatically. I think for accessibility and manageability also I ...
user avatar
  • 268
0 votes
0 answers
22 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), ...
user avatar
1 vote
0 answers
50 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 ...
user avatar
0 votes
1 answer
26 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
0 votes
0 answers
49 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 ...
user avatar
0 votes
1 answer
42 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 ...
user avatar
  • 107
0 votes
0 answers
76 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( '...
user avatar
  • 377
0 votes
0 answers
16 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' ...
user avatar
  • 317
1 vote
1 answer
78 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 ...
user avatar
0 votes
1 answer
42 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 ...
user avatar
  • 3
0 votes
1 answer
161 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-...
user avatar
0 votes
0 answers
25 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 ...
user avatar
0 votes
1 answer
36 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 ...
user avatar
  • 7
0 votes
1 answer
22 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(...
user avatar
1 vote
1 answer
117 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"> ...
user avatar
2 votes
1 answer
30 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' =&...
user avatar
  • 203
0 votes
0 answers
33 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....
user avatar
  • 1
0 votes
0 answers
62 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 ...
user avatar
0 votes
0 answers
24 views

Hide autocomplete and fetching users when adding existing users WP multisite

Normally in the Add User section in a WP multisite, there is a section that you can add an existing user of the network to a subsite. When typing to add an existing user the autocomplete function ...
user avatar
0 votes
0 answers
21 views

How to display buttons - next / previous author. On the author's page

I want to be able to list authors on the site inside their personal pages. But I do not understand what request to create, how to display the previous user or the next one relative to the current ...
user avatar
0 votes
0 answers
144 views

How to create a custom filed to upload a user profile pic/avatrar on the wp default register form? without plugin

I need a field that uploads the profile picture of the user-user profile picture who wants to register from the wp default registration form. so for that, Anyone, please help me with how to add an ...
user avatar
0 votes
0 answers
184 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, ...
user avatar
0 votes
1 answer
80 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' =&...
user avatar
  • 3
0 votes
2 answers
100 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 ...
user avatar
0 votes
0 answers
54 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 ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
  • 151
0 votes
1 answer
44 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. ...
user avatar
1 vote
0 answers
115 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 ...
user avatar
  • 2,014
0 votes
1 answer
336 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/ ...
user avatar
0 votes
1 answer
376 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....
user avatar
1 vote
0 answers
16 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 ...
user avatar
0 votes
0 answers
121 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 ...
user avatar
0 votes
0 answers
54 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 ...
user avatar
  • 101
1 vote
0 answers
19 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 ...
user avatar
0 votes
1 answer
1k 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.
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`, ...
user avatar
1 vote
0 answers
55 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 ...
user avatar
  • 11
0 votes
1 answer
145 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 '...
user avatar
0 votes
1 answer
132 views

is_user_logged_in() throwing undefined function error

I am running this simple conditional statement on my plugin page: if (! is_user_logged_in()) { add_action('init', 's8w_ajax_login_init'); } It is throwing a fatal undefined function error for ...
user avatar
0 votes
2 answers
124 views

Find count of WordPress users by role and search string for user name

I want to get the total number of results after searching WordPress users by role and a string that matches the user name. What I tried so far: $args= array('echo'=>false, 'role' => 'author', '...
user avatar
  • 213
1 vote
2 answers
374 views

pagination with numbers for WP_User_Query

I have pagination with next/previous links but I also would like to show numbers so the user can click on 2, 3, 4 etc. Pagination seems more tricky with WP_User_Query as there isn't any default ...
user avatar
0 votes
2 answers
348 views

meta query based on month regardless of year

For each user on my site I store a birthday using ACF date field (stored as YYYYMMDD). Is there a way to construct a meta query to retrive all users that their birthday on that specific month ...
user avatar
  • 5
0 votes
2 answers
578 views

Display the line breaks in user bio without using html

User fills their user bio using Formidable forms. It saves correctly and displays with line breaks in Worpdress admin on the user overview page. It displays without line breaks on the site. The only ...
user avatar
0 votes
1 answer
92 views

How to display replies to his comments in user profile of current user

How to display list of replies to his comments in user profile of current user. my website can send notification that example: "someone replied to your comment" and when i click the link ...
user avatar
0 votes
0 answers
54 views

How to do WP_User_Query for Nested Array value Inside Nested Array field

i am still new in wordpress development and try to playing with WP_User_Query right now. I have meta field, with this value: array ( 0 => array ( 'address' => array ( '...
user avatar
0 votes
1 answer
221 views

wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow

I want to get the user ID that is currently logged in. I did it successfully when accessed via a web browser. However, when this function is called via dialogflow as webhook / fulfillment it always ...
user avatar
0 votes
1 answer
57 views

How to properly use AND / OR in custom search

I have a text field and a drop down with country names. If I use OR and only fill in the text field with a person's name it brings back incorrect results. If I type in the name and select a country, I ...
user avatar
2 votes
1 answer
246 views

how to create a proper query for getting a list of users with taxonomy related meta key

I want to list user based on the sub category (which is a taxonmy). It displays users from all the sub category rather than the one I select the sub category from the back end. The code is below, ...
user avatar
1 vote
0 answers
33 views

Snippett for create field in registration for users

I have this code that creates a field in the user record, but it is not showing up in the user search. Apparently it seems to be saving or what is entering in the field, but I would like to be able to ...
user avatar