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
1 answer
49 views

Odd twitter meta data description on all pages

On this page – https://cloudmonitor.ai/contact-us/, if you do a View Source, you can see the following meta data: <meta name=”twitter:description” content=”Contact Us Contact For Premium Business ...
Rodney's user avatar
  • 133
0 votes
1 answer
892 views

How to Get Post Meta in .Js File [duplicate]

i have post meta named 'product_price'. If this post meta is called in php it can be written: <?php echo get_post_meta($post->ID, 'product_price', true); ?> How to get this post meta '...
rasyid's user avatar
  • 1
3 votes
2 answers
2k views

Get updated post meta on save_post action?

I'm trying to save post id and keyword (Yoast Focus Keyword) to a custom table when post is created or updated via save_post action. It saves everything fine on Publish (first-time) but when I update ...
Key's user avatar
  • 135
0 votes
1 answer
409 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 ...
robert0's user avatar
  • 203
0 votes
0 answers
33 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 ...
Grégoire Denis's user avatar
0 votes
1 answer
66 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 ...
Michael Stokes's user avatar
1 vote
1 answer
914 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 ...
T3mmX's user avatar
  • 13
0 votes
0 answers
330 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 ...
Badan's user avatar
  • 225
0 votes
0 answers
39 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 ...
user210478's user avatar
1 vote
0 answers
256 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 ...
Joe's user avatar
  • 111
1 vote
2 answers
635 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 ...
Rajneesh Tiwari's user avatar
0 votes
1 answer
95 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",...
saeed's user avatar
  • 15
0 votes
1 answer
156 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 ...
Rameez Iqbal's user avatar
0 votes
1 answer
38 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() && ...
Muhammad Muazzam's user avatar
0 votes
0 answers
39 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 ...
robert0's user avatar
  • 203
0 votes
1 answer
152 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 ...
robert0's user avatar
  • 203
0 votes
2 answers
199 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( ...
robert0's user avatar
  • 203
0 votes
1 answer
59 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 ...
l3est's user avatar
  • 103
0 votes
1 answer
609 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. ...
mark2090's user avatar
0 votes
1 answer
28 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.
tyruei's user avatar
  • 3
0 votes
1 answer
85 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:, ...
himmy gautam's user avatar
0 votes
1 answer
801 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 ...
Giacomo Gaglione's user avatar
0 votes
1 answer
110 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,
VietKim's user avatar
0 votes
1 answer
246 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 ...
user8463989's user avatar
0 votes
0 answers
14 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 ...
sariDon's user avatar
  • 255
1 vote
1 answer
189 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 ...
user1669296's user avatar
1 vote
1 answer
2k 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` = '...
Sem313's user avatar
  • 13
0 votes
0 answers
124 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,...
Sem313's user avatar
  • 13
3 votes
0 answers
2k 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 ...
Fabian Mossberg's user avatar
0 votes
0 answers
55 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 ...
Honoluluman's user avatar
0 votes
1 answer
31 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 ...
Hugo Montoya Vazquez's user avatar
0 votes
1 answer
302 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' =...
Meyer Auslander's user avatar
0 votes
0 answers
94 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 ...
Arkansas44's user avatar
1 vote
2 answers
3k 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 ...
0Seven's user avatar
  • 61
0 votes
0 answers
34 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 ...
AlanP's user avatar
  • 691
0 votes
1 answer
23 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 '...
wp_dev99's user avatar
0 votes
1 answer
288 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 ...
Spix's user avatar
  • 13
0 votes
2 answers
55 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 ...
rabiancone's user avatar
0 votes
0 answers
22 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 ...
John Mitchell's user avatar
-1 votes
1 answer
1k 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 = ...
Zeth's user avatar
  • 828
0 votes
1 answer
51 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 ...
Grzes Slania's user avatar
0 votes
1 answer
570 views

How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?

On the Edit Screen in the WP Admin there is a meta box for WP's built-in Category taxonomy. This meta box is built using post_categories_meta_box() (/wp-admin/includes/meta-boxes.php). This meta box ...
davemackey's user avatar
0 votes
1 answer
604 views

Adding Custom Metadata to my Archive/Posts page

I am currently working on a news website and using the Wordpress archive feature to display all my posts in a feed (when you click on the post titles you are taken to the source website).I need to add ...
Christina Marquez's user avatar
0 votes
1 answer
146 views

How to update custom fields when post is published?

I've created two custom fields on the post edit screen using the ACF Pro plugin. If the fields are empty, I want to set the current user as both the field's value when the user clicks Publish button. ...
Bhawna Saroha's user avatar
0 votes
1 answer
445 views

Avoiding ACF get_field and returning to core Wordpress function

function slb_subscriber_column_data( $column, $post_id ) { // setup our return text $output = ''; switch( $column ) { case 'title': // get the custom name data $fname = ...
WordCent's user avatar
  • 1,827
0 votes
1 answer
841 views

How to check if a post meta key/value pair already exists for a specific post

I want to know if for a given post ID $post_id, there is a metadata key and value pair stored that matches a given key $meta_key and value $meta_value pair. I am not looking for ANY post that matches ...
Álvaro Franz's user avatar
-1 votes
1 answer
60 views

Remove action of an external plugin after checking if custom post meta is set

Edit:The problem were 2 folds - somehow the order list I found before indicated wp_head was before wp_enqueue_scripts but that is not the case. Found another more updated one and it is actually right ...
Nick Li's user avatar
  • 101
0 votes
0 answers
184 views

Update Images after edit via php

After editing images directly inside the upload folder via PHP-functions, I managed to automatically regenerate the meta data, the thumbnails and the WebP copies. (Checked via FTP! Even the displayed ...
UHM's user avatar
  • 1
0 votes
1 answer
208 views

How to access post meta on the first time a post is published

Am trying to send an email based on the contents of a post published but it should only be done if its the first time the post is published. Therefore am using add_action( 'transition_post_status', [ $...
domii's user avatar
  • 1
4 votes
1 answer
6k 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 ...
Zeth's user avatar
  • 828

1 2
3
4 5
40