Questions tagged [user-meta]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

Change user meta value with shortcode

With shortcode, i want to create form to change the car's name of user function wp_change_namecar( $atts, $content = null ) { if (is_user_logged_in()) { $user_id = get_current_user_id(); ...
0
votes
0answers
66 views

meta_query for a string inside a meta field containing a comma-separated list

In my project the WP users have a custom meta field "usergroup" containing a comma separated list of values. The meta field can contain values like this: WS,CT,IS,TS,TS-IS,TS-WS,TS-CT Now I ...
0
votes
0answers
12 views

Hide users on users.php with a specific meta value

I am using the User Switching plugin in order to allow sales agents to place an order on behalf of a customer. I want to allow sales agents to switch into their customers only instead of all customers....
0
votes
1answer
29 views

WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]

I'm hoping someone can't point me to what I am overlooking. CIRCUMSTANCE: We have some unique business logic whereby a custom user meta field affects the appropriate tax class. We have three customer ...
0
votes
0answers
9 views

Can I add a unique code for each user based on the location?

I am trying to create a unique code for each user based on the location he/she adds when registering. For example: User from UAE: 971-0001 then a user from Egypt: 020-0002 Can this be done? Thank you ...
0
votes
0answers
18 views

How can I search user meta by a partial key name?

Im setting up a section in a user account where the user can block off certain days, right now its adding the meta as follows unavailable-days_1: ["16/06/2021"] unavailable-days_2: ["18/...
0
votes
0answers
35 views

Is it safe to delete unnecessary user metadata?

I'm having performance issues with my Wordpress site, due to the number of registered users, the wp_usermeta table has almost 70 million rows. Users do not have access to modify their profile so I ...
0
votes
1answer
35 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' =&...
0
votes
1answer
19 views

Counting instances of words in the results of a post query

I'm way over my head with this one and wonder if anyone can shine a light on where I'm going wrong. I am grabbing some authormeta for the resulting posts of a query, and I want to tally up the number ...
0
votes
1answer
29 views

how to get users with usermeta include array of an array

i have a user_meta for users that them is array like below: user_saved_posts = [31289,31482,27641] and i want to get users that their user_meta include an item of an array like below: goal_posts = [...
1
vote
1answer
32 views

Get user meta for only the keys with a certain prefix

There is a list of meta keys with the prefix my_theme, these are updated by the user. My problem is how to get_user_meta for only the keys with my_theme prefix. Tried a wildcard, didn't work. ...
0
votes
0answers
8 views

Query posts according to previously selected categories of logged in user

How do I query posts according to categories that a user selected at registration? The posts would be from a custom post type and match with existing post categories + custom field categories from ACF ...
0
votes
0answers
10 views

My custom user metadata is only active for only admin but i want it to be active on all users especially customers

How can i make custom user metadata which is only active for only admin be active on all users especially customers. Attached are snapshots of the issue.
1
vote
1answer
27 views

How to get a list of all possible values of a specific user meta key?

I have set up my posts with bookmarks where the user's meta will be updated with the post ID of the post they are bookmarking. They are stored in user meta key my-bookmarks as an array. Now I am ...
0
votes
0answers
29 views

How to get image path from id using SQL

I want to use a SQL query to get some random users and display an advanced custom fields profile image. Currently with this query I get the image ID back but I somehow from that need to get the url ...
0
votes
0answers
10 views

user_metadata saved but deleted just before display the page

I made custom user fields on wp-admin/user-edit.php?user_id=42. For some reasons, two fields cannot be updated but I can modify an another custom user field which had already a value. I did a load of ...
0
votes
0answers
30 views

User meta needed in query is serialized - how to unserialize safely?

I'm a complete newbie to php, and I'm trying to use a function suggested by FacetWP to pre-select the post results shown to users. (I'm using this method, rather than pre_get_posts as I want users to ...
0
votes
0answers
12 views

How to set a limit of a taxonomy term

I am seeking to allow an admin being able to set a varying limit of users who can be added to each user taxonomy term. The user taxonomy term is selected when adding a new user from the user edit page ...
0
votes
0answers
18 views

Include User ID in iFrame URL

I seem to have hit a roadblock trying to figure out how to append the user ID to an embedded iFrame url address. I am using a third party app that tracks unique users (and invoices me accordingly). ...
0
votes
2answers
23 views

WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field

I need some guidance on making a wordpress posts query responsive to user meta data, and whether it’s possible to do what I want within the query itself, or if further work is needed in the database ...
0
votes
1answer
13 views

user metadata in json format, update the data partly only

Saving JSON data as meta_value for users in the wp_usermeta table. The JSON data looks something like this: { "user":5, "levels":{ "1":{"first_seen&...
1
vote
0answers
14 views

How to properly add a custom submenu to the user's admin menu

Firstly, I'm new. Assume that I know nothing! I'm writing a small plugin. Ultimately the goal of the plugin is to allow users to choose things that interest them from a few custom taxonomies, and then ...
0
votes
0answers
21 views

get_user_meta orderby meta_value

I have the following situation: Each time a specific action is fired, a custom-id + timestamp for that user is saved in the wp_usermeta. With get_user_meta i can output and sort the data visually ...
0
votes
1answer
21 views

get_user_meta value is stored within strange characters

I'm trying to access an ID stored within a user profile using the add_user_meta and the get_user_meta function to return the ID, but when I print the values out I am given this strange value. I can ...
0
votes
2answers
53 views

Shortcode to update user meta

I want to create a button on the front end and when user click, the value "user-meta" change 'validate' function func_change_validate() { if (is_user_logged_in()) { $current_user ...
0
votes
0answers
17 views

Using REST API for custom users registration / login and user profile displaying and search

I'm reading about REST API of wordpress and I want to use it to login and register users. I need to set the user role based on the user choiche and add some information before the registration is done....
0
votes
1answer
41 views

Update user role for expired membership

Is it possible to use a function in functions.php that would automatically change user role when a membership goes from status "active" to "expired" ? For example : if an active ...
0
votes
1answer
36 views

How is it possible to current user info on page in WordPress?

I am new at WordPress. I have need to display current user info on page: avatar, name, lastname, login... I have spent several hour on web, but could not find clean solution: How is it possible to do ...
0
votes
2answers
42 views

How to save multiple values with same meta_key, each value linked to another tag id

Let´s say a user signs up to multiple memberships, each on a different date. User signs up to: Membership A on 05.03.2021 Membership B on 17.05.2021 Membership C on 29.07.2021 I would like the dates ...
0
votes
1answer
107 views

Undefined variable: user_id in get_user_meta

I got the undefined variable : user_id when i use get_user_meta $phone = get_user_meta( $user_id, 'phone_no', true ); $icno = get_user_meta( $user_id, 'ic_no', true ); when i try put the above code ...
0
votes
1answer
38 views

Update user meta when customer update their first name

I want to update the user meta when customer changes their first name. here my code: add_action( 'woocommerce_update_customer', 'can_editable_account_count' ); function can_editable_account_count( $...
1
vote
0answers
11 views

How to replicate a user plugin made table value, to this user's custom meta table value?

I have a plugin that gets a value on user register and stores it in its own automatic made table. I need to set that same value into a usermeta custom meta_value, so the user will be able to see it ...
0
votes
0answers
24 views

Trying to add current user meta data to a shortcode and display an iframe on Wordpress

I created some custom user meta fields, which I can call normally and display the info added but when I'm trying to pass this meta value on to an iframe to dynamically generate an iframe based on ...
1
vote
1answer
43 views

How to check if a meta value has already been assigned to any user?

On my website I automatically generate an 8-digits random number $rndnr via wp_rand() during the registration process and save it as user meta. How can I check if this number has already been assigned ...
1
vote
1answer
33 views

Wordpress, fetching users with an exact match in a string of comma separated values in user_meta

I have data saved in user_meta -> areapref field. It is basically a string of comma delimited post IDs (e.g. 2, 37, 200, 300 etc.) I need to check if the user has a particular ID in this field. If ...
1
vote
1answer
16 views

How do I display a user's previous orders as a select box option on a product?

I have an audio customization site (Wordpress/Woocommerce) that allows users to purchase licensed music in either an 'as-is' state or a customized version of it. The specifications of a customization ...
0
votes
0answers
22 views

Create user meta that can define key value

My problem: I am using WooCommerce. And I want each user to be able to define an extra attribute for the products. This attribute will be used to calculate the price of the product. I already have the ...
0
votes
1answer
25 views

Join Query on WP_USERMETA Table

I want to check if user time zone is perth and its belong from Group A. MY QUERY IS NOT WORKING SELECT * FROM `wp_users` AS t1 LEFT JOIN wp_usermeta AS t2 ON t1.ID=t2.user_id WHERE t2.meta_key='...
0
votes
0answers
42 views

Sort users list (admin area) by ACF post object/relationship title (not by ID)

I have custom fields for users for example "City". And "City" is a custom post type and in ACF it's using for users as a Relationship/Post object. And if in Users page sort by City ...
1
vote
2answers
274 views

set a user-meta key as avatar

i have a user-meta kay named "avatar"; This value contains the URL of the image that the user upload. how i can to set this meta value as user avatar? i use this code and not work add_filter(...
0
votes
0answers
175 views

Invalid user ID for all users

Not sure what is going on with my bedrock install, was trying to update a user role using the wp-admin panel, it refused to update, so I logged out and now I can't log in as admin or user. Invalid ...
0
votes
0answers
22 views

Delete user meta ( delete_user_meta ) by key without user id

I am new at WordPress. I am not sure is it possible or not that if I want to delete user metadata by passing the only key. for example: delete_user_meta( $key ); But looks like required a user id. Is ...
0
votes
1answer
24 views

Conditional editing CPT - using editor's role and author's usermeta

I have created a custom post type. Each author is attributed to a editor group when her/his account is created. This is save on the author's user meta I created two roles with administrator ...
1
vote
1answer
49 views

adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again

I am developing a wordpress theme for themeforest so its for commercial use and adding a custom input field of social media to the user menu in the WordPress dashboard gives error after i click Update ...
0
votes
2answers
488 views

Update user meta through a front end form

I've made a form on WordPress theme frontend that let registered user change some of their user metadata on page, but it didn't work, code like below: <form name="update_basic_user_meta&...
1
vote
2answers
402 views

'profile_update' hook alternative for WooCommerce user meta data

I am trying to get all user details (including WooCommerce meta data) in a function that is called with user_register and profile_update hooks. This is the simplified code: function get_all_user_data($...
0
votes
0answers
27 views

check metadata in wordpress

When I made the registration form, I received the contact number from the users and saved it to user_phone Meta_key with the update_user_meta function to the wordpres database. Now I have trouble ...
0
votes
1answer
68 views

JS POST update data taxonomies

How can I call the value of each term with my js function? I need use a Array not just ` useractivities=[]; $('.user_activities').each(function(){ useractivities.push( $(this)....
0
votes
1answer
21 views

Using WP for user management

I want to use Wordpress for the user management of a simple web app. What I really need to do: Check if a user is logged in Save meta data to a logged in user Read meta data of a logged in user ...
0
votes
0answers
26 views

Why is my Custom User Meta deleted on Profile Update?

I have problems with my custom user fields on updating the user profile withing the /wp-admin/user-edit.php. The values of the huna and ki field are deleted. The validation and altUserID still show up ...

1
2 3 4 5
17