Questions tagged [user-meta]

User meta data consists of key-value pairs pertaining to the according user ID.

Filter by
Sorted by
Tagged with
1 vote
1 answer
35 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? ...
0 votes
0 answers
10 views

Control page access based on User Meta data?

I want to control access to pages (and menus) based on whether the viewer has a value in a user meta data field. I've made a plugin that securely receives viewers from another private system where ...
2 votes
2 answers
127 views

How to get custom user meta by id in custom Gutenberg block

As the title says, I just need to get user meta by the user ID in a custom Gutenberg block (editor side). Essentially what this would return in PHP: get_user_meta( $user_id, 'meta_key', true ); is the ...
  • 339
1 vote
0 answers
112 views

Problems with WP 6.1.1 and the get_user_meta() function

On upgrading from v6.0.3 to v6.1.1, the function get_user_meta() (used in my theme) is not working correctly! In the following code v6.1.1 returns $guid as an empty value, however when I revert back ...
0 votes
1 answer
44 views

MySQL query to list users who never signed in

What MySQL query can I use to get a list of users who have never logged in to WP? Some background... My WordPress website has been running since 2015 and initially, I had a newsletter form that would ...
  • 183
0 votes
2 answers
43 views

A better way to write this php function

I have a function that has a few and/or operators in it. I'm sure there is a better way to write this but can't seem to figure it out. I thought I could use arrays but ran into an issue with having ...
1 vote
0 answers
58 views

Create Unique and Customized User ID for Website Members in WordPress

I want a Feature which can allow Custom User ID creation at Registration on WordPress. This will be different from the User ID that WordPress creates at Registration. This one is something that is ...
0 votes
0 answers
28 views

Import users and custom user meta from csv

I need to create some users by importing the basic user info and the wp meta from a csv file. I will need to map some custom user meta values I have into the csv during the import. I'm thinking to ...
  • 1
-1 votes
1 answer
26 views

How to display Author Profile based on Custom field value

I need to display additional author profile based on Custom Field Value. I am using native wordpress custom filed declaration. so for my custom field name is $coauthor = get_post_meta( get_the_ID(), '...
0 votes
0 answers
29 views

Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the "users search" input box

Update: A solution for this question was provided byt @t31os_ here 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 ...
0 votes
1 answer
135 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 ...
0 votes
0 answers
37 views

Add custom input field in new user page

I need to have a custom input field in the admin page where wordpress give to an admin the ability to create manually a new user. Is there any hook that will give me the ability? If yes, will this ...
  • 1
0 votes
0 answers
18 views

Wordpress - Security Question at Login from User's Meta Data

How can I add KBA (Knowledge-based authentication) Field at the time of login in WordPress? That field can be anything submitted by the user at the time of registration. For example … At the time of ...
0 votes
0 answers
19 views

Group users by meta_value

i am trying to automatically group users when they register according to a list of selections in the register form. I am using WP User Group plugin to make groups and Ultimate Member to register users....
0 votes
0 answers
32 views

How to assign a custom gender to a user role?

I'm looking for a way to assign a custom gender I created to a user role. I have also created very specific custom roles for this, but for the example, let's say that I would like as soon as a user ...
  • 1
0 votes
2 answers
34 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): ...
  • 109
0 votes
0 answers
12 views

Wp admin: I need search meta key from table wp_usermeta in screen custom post type

In screen custom post type. Custom post type is: "phone_history_list" I have column: "name" → Value of column "name"display from field "meta_key" is "...
0 votes
0 answers
15 views

get user id from custom user meta key

I have a custom user key that is mobile I want to get the user id from that. $wpUser = get_user_by('mobile', $_POST['tel']); //return null $wpUser->ID the above code return null.
  • 201
0 votes
0 answers
94 views

Update user repeater meta (ACF) with another user meta field value

My goal is to get a signed-in user to select a color (saved in ACF user meta field group) that will be applied to another user meta field inside a repeater. the field must be the same for each row ...
  • 1
0 votes
1 answer
12 views

Display Additional Info

Hello guys, i have this problem. I added this additional field but i can't get the value for that specific field I'm using this code but shows nothing: ($field['type'] === 'cedula' && !empty($...
0 votes
0 answers
22 views

Create condition for Author bio Social Links

I made Social Links for Author bio Now, I want to make a condition that whenever Social is added, the <ul class="social-area social-area-2"> </ul> class should be created. If no ...
  • 1
0 votes
1 answer
57 views

Message notification for user

I want to create alert system for users. If user get message I want to show info andout it near user image in header. So I create table for message id_message | id_user | sender_name | sender_email | ...
0 votes
0 answers
38 views

Populate custom checkout fields with data from previous orders

I have created a few custom checkout fields using the WooCommerce documentation available here: https://woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ My ...
0 votes
0 answers
43 views

Ajax Favorite from foreach (how to specify which result result is processed)

I created my first ajax script which is an add-to-favorites option on my real estate site. On the single property page the setup works great...I check if the property is already saved, display a ...
  • 3
0 votes
1 answer
44 views

delete_user_meta from a foreach results page

I have a real estate site. On property pages users can save homes as a favorite. The property gets added to the user meta data. I can successfully add and delete entries from the single property ...
  • 3
0 votes
1 answer
157 views

Show/hide posts and categories based on user meta

I've added additional input fields to the user profiles with Advanced Custom Fields (for example "type of customer"). How is it possible to hide posts and categories for users with specific ...
  • 101
1 vote
0 answers
149 views

Create membership number for existing/new users

I have a membership site with 4000+ users currently on it. I am needing to give both new/existing users an automatic ID number. its very similar to this: Create Unique ID for user However, this only ...
0 votes
1 answer
49 views

Sort users by meta key value even if meta key not present for all users

Only some users have a specifice meta_key some_metakey associated with their ID. The following args successfully orders users with a specified role by some_metakey but only those with that meta_key. ...
0 votes
0 answers
45 views

Linking form to user meta fields

I currently have my login page set up to allow sign up through google. Immediately after a successful sign up I'm looking to set up a redirect to a form where the user can enter additional details and ...
0 votes
0 answers
23 views

Auto populate a user custom field from another user custom field

I have a WP theme with its own custom fields including one for Phone Number. I also installed the Digits Plugin which allows users to sign up/login with their phone number and OTP, which has its own ...
1 vote
0 answers
210 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 ...
0 votes
0 answers
12 views

Add WordPress user custom meta to chartjs vertically stacked chart in Divi theme

I have created a user dashboard using the Divi theme where I need to add a chart like the attached screenshot. The data are specific for every different user. I have tried many premium plugins but ...
0 votes
0 answers
16 views

Compare User meta_value with Product meta_value

In Wordpress I've added a new field called "user_branche" on the user edit profile page within the admin. On the Woocommerce product page in the admin I added a meta field called "...
  • 113
0 votes
0 answers
47 views

How to store checkbox data for individual users?

I am working on a video-course website and I would like to add a checkbox next to each video so that when a student finishes watching the video, they can mark it complete and when they return they ...
1 vote
0 answers
288 views

Rest API code to get ID of current user not working: get_current_user_id() gives 0

Background I am trying to write Rest API code to get the ID of the user who triggers the function in question. I found a fantastic answer to this exact question, that was very kindly provided by user ...
  • 11
1 vote
0 answers
58 views

How to redirect on login to a specific page if a specific meta user is empty

I would like to indicate that if you do not have the first_name filled in when logging in, you will be redirected to a specific page, for example /onboarding and if the first_name field is filled, you ...
0 votes
1 answer
19 views

How to pull all the contributer users records and order by Designation (which is users meta data)?

I want to show all the contributors by the Designation. Following code is only pull the records and order by ID But I need to data order by Designation: function contributors() { global $wpdb; $...
0 votes
0 answers
135 views

Check For get_post_meta on Author Archive Page

I've had a good look thru the Similar Questions for an answer and i'm looking to check if a value for a custom field key on single posts has been added using get_post_meta(); however i want to use ...
  • 446
0 votes
1 answer
75 views

Delay action unltil the untill previous (hoocked) action is completed

I'm quite new here so I hope you'll find my question documented enough. I've been digging into this for a while now, and haven't found satisfactory solutions, despites some looked relevant! Basically, ...
0 votes
1 answer
570 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 ...
0 votes
1 answer
485 views

ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?

I am looking for a way to query users based on a user meta entry for an advanced custom field which has a given value and itself is from a given layout type. For example, let's say I have the ...
0 votes
1 answer
24 views

How $_GET['updated'] variable is passed when updating a user?

I have added two user metas and they are functioning perfectly. Now I want to show a warning message according to the input. I have passed the status through a get variable(named meta_warning through ...
  • 225
1 vote
1 answer
1k views

ACF: How to get the full field name (meta_key) by a field key?

In Advanced Custom Fields: Which function can I use to get the full meta key of a field by its field key? So, if I have a field with the name some_field and the field key field_sd54hfs5df: How do I ...
0 votes
2 answers
102 views

Fetch user related data

In my WordPress installation every User has an Organization. I am fetching user data using get_user_meta ($user->ID). With these data I can fetch Organization ID. Organizations are saved as Custom ...
  • 407
0 votes
1 answer
107 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 ...
  • 107
0 votes
0 answers
81 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( '...
  • 407
0 votes
1 answer
34 views

Delete user meta but only if found in array

I created a SAVE button that saves a page's URL to the user meta in an array. I'm trying to now create a REMOVE button but I'm finding that when delete_user_meta is used it deletes all entries in the ...
  • 3
0 votes
1 answer
20 views

Associate multiple email addresses with the same user account, so they can log in with either

Is there a way to associate multiple email addresses (2) with the same user account? The goal is for the user to be able to use their company email or personal email to log into a company portal - ...
  • 143
0 votes
1 answer
75 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 ...
  • 3
0 votes
1 answer
54 views

Create Wordpress User in backend, and automatically create a new post in Custom Post Type with user uame as the Title in the post

We are developing a golf tour itinerary system for our clients, and we only want client with unique booking reference 221234 to see their tour itinerary, which is on a CPT titled 221234. Is there a ...

1
2 3 4 5
18