Questions tagged [meta-value]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 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
19 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
30 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
25 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
20 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 ...
1
vote
0answers
57 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
105 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
32 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
45 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
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 ...
2
votes
1answer
66 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
15 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
22 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
34 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
16 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
17 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
17 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
32 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
0answers
27 views

Gutenberg does not render changes in array of objects meta

A post has a meta value which contains array of objects. Seems like the values printed in a loop in fields do not render a changes unless I send a new meta key with dispatch. This does not work, If i ...
0
votes
2answers
27 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
0answers
13 views

How to exclude same meta key value while post

$argz = array( 'post_type' => 'episode', 'tax_query' => array( array( 'taxonomy' => 'episode_tag', 'field' => 'slug', 'terms' => array( $title, ) ) ), 'meta_query' => array( array( '...
0
votes
0answers
24 views

meta box image responsive srcset and sizes attributes value

I create meta box and and save it's value update_post_meta( $post_id, 'cover_image', sanitize_text_field( wp_unslash( $_POST['cover_image'] ) ) ); I use it in template - <?php global $wp_query; ...
0
votes
0answers
15 views

Filter and order post by more custom fields

I have a problem with following code. I want to filter post by two input checkbox, for example a and b, and order the result by meta value (contained in relevant post as meta value num). The problem ...
0
votes
1answer
14 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
24 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
16 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 ...
0
votes
0answers
352 views

Multiple Select on Gutenberg Sidebar as metakey

I want to show a multiple select element in the sidebar when editing a page in admin, where I can save the selected values in a metakey. Of course also load the selected values upon load of page-edit ...
1
vote
1answer
67 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
27 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
36 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
28 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
160 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
75 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
181 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
22 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
31 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
48 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
85 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
346 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
90 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
12 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
369 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
26 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
vote
1answer
53 views

How can I convert postmeta from unserialized to serialized?

I'm replacing 2 fields that were previously set up with ACF and saved separately. Instead of those, I want to have 1 piece of serialized postmeta. So, I'm going from meta_key: old_key_1, meta_value: ...
0
votes
2answers
26 views

Find a way to retrive data updated through metabox plugin to web page

I developed a customer metabox plugin to save user details to db and retrieve them back to Contact Us Page in my website. But I searched a way to retrieve the data to contact us page and I couldn't ...
1
vote
1answer
259 views

Need wp_query to return all children and grandchildren

I am working on a site with three different main 'topevel' sections, that act as the top level parents of the site. Each toplevel section has children and grandchildren, and there needs to be a ...
1
vote
1answer
22 views

OG Meta Tags not being scraped by facebook or twitter

When trying to share a blog from my wordpress website on social media, (facebook, twitter), there is no URL preview card. No picture, no description, nothing. I installed yoast seo plugin on my ...
1
vote
0answers
23 views

Meta_query on same meta key, with diffrenct values

i'm trying to get_users with the meta_query where i need to find users where either they don't have the meta key, or it is blank. It seems like everywhere i look, i should be able to use the OR on ...
0
votes
1answer
338 views

Prepare WPDB with meta key and meta value

I'm trying to prepare WPDB by post type, meta key, and meta value global $post; global $wpdb; $rid = absint($_POST["rid"]); // number $last_id = absint($_POST["lastID"]); // post ID $query = $wpdb-&...
0
votes
0answers
63 views

Get meta_value from GDRating

I am trying to get meta value from GD Rating table for each post ID with following sql: $querystr = "SELECT meta_value FROM $wpdb->gdrts_itemmeta WHERE meta_key LIKE 'stars-rating_rating'"; $...