Questions tagged [post-meta]

Post meta is a data set containing additional core as well as custom post information.

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

How to join Caption AND Description Meta Fields as one combined-caption in Image Block

Use case: Inserting Image Block (inapplicable for others, like Gallery Block). I'd like to use caption (post_excerpt) as real description of an image (what it shows), and also append additional info, ...
0
votes
1answer
15 views

Compare two meta key values against each other inside the get_posts array?

I'm banging my head to the wall all day trying to figure this out. I have two meta keys a1 and a2 with numbers inside. I'm trying to show posts that are a2 > a1. In a nutshell, here's what I'm ...
0
votes
0answers
9 views

How can I update this array built from post meta data?

I'll try and do this as concisely as I can, apologies if it's not! I have two custom post types: 'Psychic' and 'Review'. There can be several 'Review' posts for a single 'Psychic' post. I link the ...
0
votes
0answers
27 views

Sorting my posts on homepage my specific value in post_meta table

I'm rather new to Wordpress development, and i have been making my own code to count and display views count on posts. Now, what i'm trying to do is get the homepage to sort these posts in descending ...
0
votes
1answer
53 views

How can I write a function that would update any missing specific post metadata?

I was given an assignment that follows a scenario for basketball players. It contains a custom post type 'player' that exist with a meta field call 'player_external_id' assuming all players has a very ...
1
vote
1answer
25 views

update post meta for checkbox in the admin when inserted in the front-end

Here's my problem, I allow a certain user type to create custom post type in the front-end of my site, with the wp_insert_post() function... users can put values within a form and there's couple of ...
0
votes
0answers
36 views

Bulk Update Post Meta Values from Different Post via Rest Api

When I edit a custom post type in the Block Editor, I have successfully added a post meta (featured toggle button) in the Gutenberg Sidebar. When saving the post, I want to do two things: save the ...
0
votes
0answers
22 views

metabox upload multiple file

I have upload multiple file metabox, my problem is I need to display all files links attached to this post inside the post editor. when i upload the files it is already saved under the media but the ...
0
votes
0answers
38 views

What format is this and how to get value "lal" and "pila" from it

[2] => a:2:{i:0;s:3:"lal";i:1;s:4:"pila";} saved by wordpress function as an array add_post_meta($contestid, 'suraj', array('lal','pila')); and retrieved by the function ...
1
vote
0answers
25 views

_wp_attachment_metadata is not being added to database when PDF files uploaded

When I upload a JPG or PNG image, a _wp_attachment_metadata value is created in the database, but this is not the case for PDF files. Is this the normal behavior or should the _wp_attachment_metadata ...
0
votes
1answer
21 views

How to remove bulk actions from custom post type

i am currently trying to remove the draft(action) from the custom post type dropdown menu. I am sharing a screenshot it will help you to understand my question. I have no idea how to achieve this, is ...
0
votes
1answer
32 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

wp query to use both author id and meta_query

I'm trying to display posts of an author by id OR those posts which have a meta value as author ID. I have a custom field in the posts section as Additional Author (additional_author) and now I want ...
0
votes
1answer
50 views

Get woocommerce variable product metadata

I want to get woocommerce variable product _sale_price_dates_to. The code below works fine for single products. $dates_tosale = get_post_meta($product->get_id(), '_sale_price_dates_to', true); But ...
0
votes
0answers
18 views

get_post_meta always empty in 'publish_post'

i'm trying to get values from 'get_user_meta' and 'get_post_meta' while sending an notification Mail with the action 'publish_post'. All of my needed variables are empty. But why? function ...
0
votes
0answers
10 views

Move Featured Image upload field into other meta box in custom post type

add_action('admin_menu', 'st_series_cpt_add_box'); function st_series_cpt_add_box() { global $fichead_meta_box; if( current_user_can('editor') || current_user_can('administrator') ) { ...
0
votes
1answer
15 views

Condition to check previous next article post title

I have to modify post title at runtime and it should not affect related and previous, next link post titles. What other condition should I use for it with these: if(is_single() && ...
0
votes
0answers
105 views

Gutenberg sidebar SelectControl meta value not updating

I am have created a select option to plugin sidebar. It saves value the first time into the database but doesn't update it. I have tried this code. see JSX code. const { __ } = wp.i18n; const { ...
0
votes
0answers
19 views

Loop for recently (updated_post_meta) posts?

I'm trying to create a simple loop for recently updated post meta_key. Basically, let's say someone liked a post. When like was clicked, that updated post meta_key 'like' value. I want to display on ...
0
votes
1answer
10 views

How to add and subtract user meta values after post meta update

Basically, I'm trying to make a point exchange between current user and author when the post meta value is updated. As well as add +1 to post meta. Here's what I currently have: // Coin exchange ...
0
votes
2answers
26 views

How to use two meta_compare in an array?

I want to use two meta_compare in an array. // get posts $posts = get_posts(array( 'post_type' => 'post', 'posts_per_page' => 150, 'meta_query' => array( array( ...
0
votes
0answers
25 views

Add new post meta data after updated_post_meta?

Here's the situation. Basically, I'm trying to add user ID (to the newly created post meta data) that hearted the post. My current code: add_action('updated_post_meta', 'add_likers_id_to_post_meta'); ...
0
votes
1answer
19 views

How to fill custom fields with brackets in their key with add_post_meta()?

I'm trying to fill WP SEO Structured Data Schema fields with add_post_meta function and it doesn't work properly. I checked one of the posts that's added from Wordpress admin panel and it was saved ...
0
votes
1answer
23 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
27 views

Frontend query and does not need to log in [closed]

I would like to query a post meta called 3-serial on the frontend page. Once queried, start_date and end_date will appear. I do not know where to put the codes too.
0
votes
1answer
35 views

How to display custom fields in hestia theme

I want to display my custom fields on the Posts page just next to the author’s details, date, and any other meta data of post in the listed posts. I already have done this in Magazinenp theme ( ID:, ...
0
votes
1answer
40 views

Get data from custom table and update relative post_meta based on meta_key

long story short: I need to retrieve data from WordPress-created custom Table and add/update metadata to the related post (post_type=product). I can match the posts (products) and custom table fields ...
0
votes
0answers
15 views

How to bulk Update URLs to new values?

How to bulk update 50 posts with old URL=https://bkfast.vn/san-pham/thiet-bi-trong-rau-sach-thuy-canh-bkfast/ to new URL=https://bkfast.vn/bo-trong-rau-thuy-canh/ ? Tks in adv,
0
votes
1answer
17 views

cannot get user_registered date from get_user_meta

I am trying to display the user_registered date from get_user_meta but it always displays as empty. If I try another field I do get a value so not sure why I don't see anything for the date. If I ...
0
votes
0answers
10 views

Select another post in a post meta like a parent page is selected while editing a page

I have a series of 'post's like 'Title 01', 'Title 02', 'Title 03', ... and so on. When editing a 'post', I want to add a previous and a next post (of the series) ids as the post meta. I have added ...
1
vote
1answer
25 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
1answer
30 views

SELECT custom post type and its meta in SQL

So I have the following SQL script where I can view all my post_meta with specific meta_keys: SELECT * FROM `wp_postmeta` WHERE `meta_key` = 'honorific' OR `meta_key` = 'suffix' OR `meta_key` = '...
0
votes
0answers
22 views

SQL DELETE multiple post_meta on single and multi-sites

So I don't have too much knowledge on SQL and running scripts, so I wanted to see if the community can help me. Here is what I'm attempting to do: Delete all post_meta that has the meta_keys honorific,...
2
votes
0answers
123 views

Correct processing of `$_POST`, following WordPress Coding Standards

Background I'm building a project that according to the specifications need to follow the WordPress Coding Standards. I am using phpcs to scan my code. If I try to pass $_POST-data into a function ...
0
votes
0answers
40 views

How can i set media attachments to the author of the post or page for already existed posts with attachments

I have been uploading posts for multiple authors in my site and the attachements (photos) are registered all in my account. Is there a way to set the attachements to have the author of the post ? I ...
1
vote
1answer
16 views

WP nonce field checkbox prints checked='checked' outside input field

I'm currently creating a custom post type in wich I want to add some custom meta boxes. All the fields just go as expected excepting a checkbox field wich prints on the html checked='checked' after ...
0
votes
0answers
17 views

insert metadata on title

I have this function add_filter('wp_insert_post_data', 'modify_post_title', '10', 2); function modify_post_title($data, $postarr) { $customer_name = $_POST['customer_name']; if ($data['...
0
votes
1answer
84 views

Strict comparisons problem when using boolean post meta

register_meta( 'post', 'my_boolean_meta_value', array( 'show_in_rest' => true, 'type' => 'boolean', 'single' => true, 'default' =...
0
votes
0answers
33 views

Custom meta fields and meta keys

I read that you should only use lowercase letters for meta keys for custom fields - is this true? I need to set up several custom meta fields for products, and I would like to use a capitalized first ...
0
votes
2answers
629 views

"Cannot use import statement outside a module" JS error while adding a custom meta block?

I am following the "Store Post Meta with a Block" guide from the official Block Editor Handbook to add a custom post meta block using the supplied sample code (below). However, the block ...
0
votes
0answers
29 views

Why is the actual number of thumbnail images not matching what is store in an attachments metadata?

Occasionally my plugin needs to delete an image and its thumbnails images. However sometimes there is a discrepancy between the number of thumbnails an attachment has and the number of thumbnail files ...
0
votes
0answers
22 views

Disable preview button when post already publish

Hi is there any functions that we can use to remove the preview button after the post is published? What I need is when post never published yet, the preview will available there, but when you already ...
0
votes
1answer
5 views

Custom column on CPT not showing correct value when meta data not set

Basically I have 2 custom columns in the 'edit.php' of my custom post type. What I need is when $item_type is set to 'page' but there is no page selected, 'No selection' is echoed (same for when '...
0
votes
1answer
108 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
2answers
34 views

get_post_meta shortcode returns empty field

I'm trying to create a custom shortcode that will allow me to input custom order field data into an auto generated outbound email template via the Custom Order Status for WooCommerce plugin. My ...
0
votes
0answers
19 views

Update Pages ONLY from Stage to Live (not products)

I have a WordPress site that has a bunch of posts, a bunch of pages and a bunch of products (Woocommerce ones). I Staged the site and made loads of changes to the pages on stage, meanwhile the live ...
0
votes
0answers
22 views

update_post_meta() inside "save_post" hook doesn't save to database - only through REST API

I have a function that is being called whenever a woocommerce product is published (through the save_post hook). This function uploads a few images, attaches them to the current post being saved (...
-1
votes
1answer
34 views

How to save custom made object in an array in a post meta field

I've made two custom classes: FooBar BarSchizzle I'm making a quite custom calculation of a bunch of things, that I would like to save in an array in a post_meta field. This is how I save it $obj1 = ...
0
votes
1answer
20 views

WP API Response does not show my registered metadata

I am trying to get metadata from a custom post type splash_location however it's not showing up in my response. I have registered my metatag splash_location_title but it doesn't show up in my JSON ...
0
votes
0answers
22 views

Display Custom Post Types & Post Meta in iCal

i'm a real noob so please go easy. I'm trying to edit something i found online, but with minimal knowledge. I'm sure i'll get told that i've done it totally wrong, but i'd rather try than just ask how ...

1
2 3 4 5
39