Questions tagged [meta-value]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 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 ...
0
votes
2answers
26 views

Negative meta_query if storing multiple post_meta values with shared meta_key

WordPress supports storing multiple post meta values for a single post using the same meta key. For example one post can have multiple instances of meta_key 'pet' with meta_value 'cat', 'dog', and/or '...
0
votes
1answer
50 views

get posts based on non-single metadata

I have meta data to custom post "event", registered as non-single, i.e., there is an array od metadata "terms" (it is not WordPress term, I just call it term, it is a record ...
0
votes
1answer
15 views

I have 3 types of prices in WP and I need to change price for each specific user role using hooks

not a tough coder so could use some help here. What I'm trying to do is, I have 3 types of prices in WP and I need to change price for each specific user role using hooks https://itgalaxy.company/%D0%...
0
votes
0answers
16 views

Show metadata in users.php - wordpress

is there any way to show metadata in the list of all registered users "users.php"
0
votes
0answers
18 views

How to use custom slug and custom templates for custom taxonomy?

I haven't used taxonomies much, so not sure what the correct way to do this is. I have a custom taxonomy called collections. I want an archive page for this that shows all the collections. I can ...
0
votes
0answers
42 views

WP_Query - sort the results by meta value custom attribute wocoomerce

I’m trying to sort products by attribute value. The attribute value is alphanumeric I started from this code Trying with the following code add_filter('woocommerce_get_catalog_ordering_args', '...
0
votes
0answers
68 views

Order (by ASC) posts with meta_key so posts without values are last

I am trying to figure out sorting posts with prices in one meta query, so the posts without prices are shown last, when ordered by ASC and not first. Right now I am temporarily not showing posts ...
0
votes
0answers
11 views

Set all WooCommerce Products to Simple, Virtual & Downloadable

I want so set my all products of my WooCommerce store to Simple -> Virtual and Downloadable Programmitacly. And hide all the Unwanted tabs & fields like shipping, Inventory, etc.
0
votes
1answer
35 views

why after saving meta value it's saving all the values the one that i clicked?

I have a code that save meta post and show them to the visitors: <?php if(is_singular( 'manga' ) ){ $manga_link=get_post_meta($post->ID,"featured_fields_manga",...
0
votes
1answer
22 views

how can i update my postmeta without losing old data?

I have a code that stores old and new meta_value in the same meta_key but i don't know if it's right or wrong (note that i want to store data in the same meta_key not separate meta_key): <?php ...
0
votes
1answer
53 views

Best Practice? - Saving multiple Values as Serialized Data / Saving each Value per Row / Dedicated Table

For each user the following is to be saved: user_id tag / tag_id (eg. 1,2,3,4,...) timestamp first_seen (for each tag) timestamp last_seen (for each tag) Options which come to my mind: One Row ...
0
votes
1answer
34 views

How to update and save user metadata on page visits?

Basically I'm looking for something like this: <?php if ( is_page( array( 'home' ) ) ): ?> update_user_meta( $user_id, 'pagehome', '1' ); <?php else: ?> ...
0
votes
1answer
46 views

if get_post_meta function returns empty - Do Not Display HTML

I am working on a website with some custom PHP. The post uses "Custom Fields", where the custom field "pdf_name" is added to the post when there is a PDF document to attach to it. ...
0
votes
1answer
269 views

Sort products by Sale price and stock status

I want to sort products by sale price and in stock and regular price at first but doesn't find solution anywhere. Here is what I have implemented and didn't get the solution: add_filter( '...
0
votes
0answers
30 views

Query to show post current day

I turn to you since I tried by my means but I could not achieve it It turns out that I have the need to create an rss file to use it in external applications, I have a type of post (events) which ...
1
vote
1answer
30 views

WP_POSTMETA - What do these values mean inside the data structure?

In the wp_postmeta table, I am seeing data in a field called "meta_value". The structure of the data is confusing. I am trying to understand what these values mean: The meta_key field ...
0
votes
0answers
62 views

Hide pages/posts from internal search based on selected meta value

I'm working on a plugin that hides pages/posts from internal search widgets and search engines. However, I need help getting it to work. I have a custom metabox showing up on the create page and ...
0
votes
1answer
118 views

How to use multiple Meta Field from CPT as Post permalink

i have created a custom post type using Jetengine called "cars" and meta field like this "model" "maker" "year" .. etc, what i want is to use more than one meta ...
0
votes
1answer
37 views

WP Query Meta Value - How To Identify Specific, Unique Values?

On my Club Profile pages, I'm displaying a list of posts (Player Profiles) where the title of the specific Club Profile page is also a meta value contained in those Player Profiles against one or two ...
0
votes
0answers
93 views

Meta Query | Compare category name and meta value

I like to create meta query that has a condition like this. Using comparison of meta value, and omitting articles which belongs to category that is same name of meta value. Each article belongs to ...
0
votes
1answer
35 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 ...
2
votes
1answer
666 views

How to get all term meta for a taxonomy - getting term_meta for taxonomy

TL;DR: I'm trying to get the meta_value display_type for a taxonomy, but it returns blank (even though I can see it in the database). This question wants to access a term meta that is on a the ...
0
votes
1answer
20 views

Save queried result into database

in multi author website when author publish post , he/her can give star rating to his/her own post. and I can display average rating for every taxonomy term using this formula: AVERAGE RATING=TOTAL ...
1
vote
0answers
27 views

How to change File URL in file uploaded to s3 compatible storage with self written plugin [closed]

I'm trying to write a plugin that uploads files directly to an S3 storage and allows to downloads them like files directly on the server. The main page of the plugin contains the following code for ...
1
vote
0answers
39 views

How to orderby multiple meta fields if some fields are empty

I'm trying to orderby meta fields value, but sometimes those values are empty : A > title = 'The apartment', wpcf-f-french-operating-title = ' ', wpcf-f-order-title = 'Apartment' B > title = '...
0
votes
0answers
52 views

ACF update_field is not getting saved after wp_insert_post

I have the following loop where I insert new custom post types in db and after I try directly to add some ACF field values which they are never getting saved. What is wrong in this case with the code ...
1
vote
0answers
25 views

How to filter meta_values using REST API

i am able to get the data by make an API called with these args ?meta_key=frequent&meta_value=day are there any possible way to filter with multiple meta_value? i already tried meta_value=day,week ...
0
votes
0answers
19 views

WordPress meta query for serialize associated array meta value

Serialize array value is: a:13:{s:7:"relaxed";a:7:{s:4:"name";s:7:"Relaxed";s:5:"votes";i:377;s:7:"term_id";s:5:"28595";s:4:"slug";...
0
votes
0answers
52 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 ...
0
votes
2answers
28 views

How to use get_terms() returning only the terms that have posts with a certain custom field value

I use get_terms() to build filter buttons to enable filtering a list of events (custom post_type). $terms = get_terms( 'kategorien', ['orderby' => 'slug', 'hide_empty' => 1 ]); Now we want to ...
0
votes
1answer
16 views

Set class if a meta value is set within post archive

I'm attempting to add a class to posts when the meta key 'checkbox' is clicked. Here's what I have: <?PHP $checkbox = get_post_meta($post->ID, 'checkbox', true); if (!empty($checkbox)){ $...
0
votes
0answers
29 views

Querying terms with calculations based on term meta data, sql vs. get_terms

Is it viable and or advisable to try and implement a query like the below through get_terms and its meta query functionality? Basically, I query terms of a specific taxonomy 'pr' that have meta fields ...
1
vote
0answers
21 views

How do I set default meta value by post type?

I'm trying to set a meta variable depending on what custom post type is set but can't get my code to work. This is the function in the plugin that sets the metabox after the plugin has added it to ...
1
vote
1answer
109 views

How to break meta values into different items and avoid duplicates?

I'm trying to build a filter for a custom post type page. The custom post type has a metabox that allows inputting of different authors. I am displaying the post names in a dropdown like this, using ...
0
votes
1answer
31 views

Query custom post type custom meta key

I want to get all post with the value X looking in the meta_key field. After tha I want to loop trough all post and get the title. I got this so far. function get_events( ) { $recurrence_ids = ...
0
votes
0answers
40 views

WP_Query multiple value not working

How to query for multiple meta key values with the same key i have this query but multiple value not working for me, Where is my code wrong? if( isset( $_POST['scheduled_scan'] ) && $_POST['...
0
votes
0answers
30 views

When I add metadata, metavalue length is added in to the value in some cases

When I use the following code: update_post_meta($new_post_id, '_test_metakey1', 'a:1:1;'); update_post_meta($new_post_id, '_test_metakey2', 'a:1;'); The database adds the keys as follows: Why does ...
0
votes
0answers
188 views

Query posts by current ACF meta key value on single page as related posts

I would like to Query a custom post by the current ACF Meta Key values on a single custom post type page. I currently have a CPT called "news", a single-news.php page and ACF checkbox ...
0
votes
0answers
77 views

How to get the total of two meta values from different meta keys?

At post meta I have two meta keys: 'old_views' and 'new_views', so I need a function to get the total value of these both combined and save it as a new meta key called 'total_views'. For example: '...
0
votes
1answer
337 views

How to save a meta_value as a numeric value after I retrieve it via update_post_meta?

I tried things like $meta_rwp_user_score = (number_format_i18n($meta_rwp_user_score, 2)); , but this is not working. Where do I use that? <?php $meta_rwp_user_score['meta_rwp_user_score'] = ...
0
votes
1answer
104 views

How to search usermeta table

What is the best way to search usermeta to find a user_id based on a meta_value? For example in usermeta table there is a row with user_id = 123 , meta_key = deviceid and meta_value = 45545. I know ...
0
votes
0answers
36 views

How can I list users by date in an array in meta_value?

I keep an order list of all users. I keep this list in the meta_key value named payments. The payments meta allows me to keep information about the payments the user made. To give an example for an ...
0
votes
1answer
61 views

How to order users by a date in the meta_value array

I have an 'payments' meta_key for the users. I store the payment information (date and payment amount) received from the user in meta_value connected to this meta_key. For example: array( [0] => ...
1
vote
1answer
92 views

Custom query for sidebar isn't returning results

I'm trying to create a shortcode that runs a custom query based on Yoast's primary category meta key. The goal is to pull posts with the same meta key value of the post being displayed and show 4 ...
1
vote
1answer
519 views

How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)

Sorry guys, had to post this again as site wouldn't let me respond to comments (new account). I have been working on some code to decrease quantity of a variable product based on the numeric values ...
0
votes
1answer
128 views

How to update/add child posts meta whenever the parent post meta is updated?

I couldn't find a solution to a very simple problem. When a meta value for the parent post is updated, I want the meta value of all child posts linked to this parent post to be updated. For example: ...
0
votes
1answer
13 views

Custom Meta Box: Value saved in WordPress DB, but not shown in input field on Edit Screen

i have a custom field like this: function nutrix_display_recipe_mb( $post_object ) { global $post; wp_nonce_field( basename( __FILE__ ), 'recipe_mb_nonce' ); // PREPARATION TIME FIELD $html = '';...
0
votes
1answer
499 views

Update a list of product to featured if product have meta value (Mysql not wpquery)

Since woo 3 featured product is name and slug of taxonomy 'product_visibility'. I need to update all products with same meta_value contained in list to 'featured'. My products have a meta_key = '...
0
votes
1answer
30 views

How to get specific attribute from DB

a:3:{ i:0;a:2:{s:21:"wwsd_percent_discount";s:2:"10";s:25:"wwsd_minimum_discount_qrt";s:2:"20";} i:1;a:2:{s:21:"wwsd_percent_discount";s:2:"20";s:25:"wwsd_minimum_discount_qrt";s:2:"50";} i:2;a:...

1
2 3 4 5