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

Trouble with serialized metadata

I've read about 20 different posts on this topic and I still can't apply the solutions to the problem I'm having. I'm very sorry for not being able to figure it out based on those answers, but I ...
0
votes
0answers
13 views

How to get posts by meta value as multi-dimensional array?

I know how to get posts by a specific post meta when the meta value is a string. $meta_query = [ [ 'key' => $meta_key, 'value' => $meta_value, 'compare' => '=' ...
0
votes
0answers
11 views

Updating Wordpress Yoast Meta description through SQL Query

I have updated wordpress post's Meta description through SQL Update query. But it doesn't reflect on my published wordpress post until i edit that post and click on update button. How can i fix this ...
0
votes
0answers
15 views

Store array as single, serialized post meta field or many post meta fields?

I am currently building a Wordpress plugin to fulfil WooCommerce orders for a "virtual" product. Once the payment is confirmed, I make an API call that returns a large (~50 values) array of ...
0
votes
0answers
16 views

Don't know why post meta doesn't work even no error is thrown

I am having a problem with post meta. I have a custom meta box for posts. But when I select the option it doesn't work. Neither does this code throw any error. One week ago it worked like charm. Here ...
0
votes
0answers
8 views

can't get url parameters working with metadata for searching posts

I am trying to get a custom feild added as a search paramter url. my post metadata for this example is 'public_paywall' and want to register as it as a query var "access" This is the code I ...
0
votes
0answers
11 views

Post ID into plugin

I have a small plugin to update the acf fields in a posts. In each post, there are many fields that need to be updated with the received data from the API. In the code below, I first demonstrate from ...
0
votes
0answers
11 views

Save a loop of single meta box data from selected dropdown lists

The layout of my edit post page I have 193 countries in Afghanistan post and in every single post "passport". I want add post meta data for "Visa Status" for each country of the ...
0
votes
1answer
43 views

No more get_option('date_time') in Wordpress 5.5?

The template I'm using outputs the date of a post using: echo get_the_date( get_option( 'date_time' ) ); I was wondering why this output is now (after upgrade to WP 5.5) not working anymore? A fast ...
0
votes
0answers
8 views

Uploading an image provided by user on form submission into Custom Post Type meta fields

I am really pulling my hair out trying to find a way to pass an image into a Custom Post Type's (CPT) meta field when the user submits the form. So that I can then echo it out for use later. The ...
0
votes
1answer
13 views

Unable to gather Image URL from Custom Post Type's; Custom Meta Field

I have wrote a very basic plug-in, it creates a Custom Post Type (CPT) that has multiple custom meta fields. I cannot seem to echo out the Image URL. I have tried a heck of a lot of other similar ...
0
votes
2answers
17 views

How to keep custom post type related information

I have two custom post types "Product" and "News". I want to keep a description that describes each of these types and I want to display it under the custom post title inside a ...
0
votes
1answer
20 views

Adding custom meta boxes to specified custom post type

In previous situations I have been able to add a custom meta field to posts, the code was this: function website_add_meta_box() { add_meta_box( 'website-website', __('Website', '...
0
votes
1answer
27 views

Update wp_postmeta table based on 2 keys

I want to update the wp_postmeta table in the database based on 2 keys, is there a way to do that using any of the wordpress default functions. This is my DB query which is working fine: $sql = "...
0
votes
0answers
14 views

Add/Update grouped Meta Data with custom post type

I am working on this plugin where Download Plugin file: https://armorlube-my.sharepoint.com/:u:/g/personal/qasim_armorlubricants_com/Eae1VTKE3eRLkRq-qkP6yLkBdZSwDe1CIhyMUHn2lENuBQ?e=Q4U0PV I have a ...
0
votes
1answer
23 views

Convert post meta to custom taxonomy?

I'm working on a site update for a client. The current version of their site stores a lot of information within custom post meta fields, added as plain text boxes using Advanced Custom Fields. We ...
0
votes
0answers
5 views

Sort order of tags on post by post basis

I would like to be able to add an order to my custom taxonomy tags per post, so when I call them on the front end they go into a certain order. So one post might have the tags ordered "James"...
1
vote
1answer
19 views

How to duplicate entire custom post type

I have a custom post type created in my theme, the post type is called "Portfolio". I would like to entirely duplicate this custom post type and give it the name "Projects" so it ...
1
vote
1answer
18 views

How to use update_post_meta() function properly?

So I am working on a something like a plugin in my custom wordpress theme, and and in an options page I have a form whose action is the php file _options.php, in normal manner some data will be sent ...
1
vote
1answer
24 views

Copy content stored in meta to post content

I'm working on a site that had an existing theme that used meta fields to store blocks (bad practice IMO but pre-block editor). The problem is there are over 300 posts and all the different "...
0
votes
0answers
6 views

Woocommerce New Tab Content with multiple meta data value

I created the new tab in woo-commerce & I would like to add the following custom-fields/meta-data in this tab. It only outputs first four values. Tried these as well, need help. // Display the ...
0
votes
0answers
22 views

Best practice to show table data with filtering option

I have a database of foods and their nutrition values that needs to be shown on the website based on schema.org templates. The data needs to be displayed in one table with a big amount of data( nearly ...
0
votes
0answers
20 views

get_terms based on post meta value

I'm listing events using the following arguments for my query, these load in via ajax and have a filter: $date_args = array( 'post_type' => 'events', 'meta_key' => 'event_start_date', ...
0
votes
0answers
6 views

do I have a duplicate from Reference post and connect it's content to edit post?

I have a WordPress blog. that have common content in each post. I want to create custom post type and custom field for any media that can have the same data and just I will write each time different ...
0
votes
1answer
19 views

How to exclude posts by meta key value in the_post_navigation next prev links?

Context: We created a plugin, that allows posts to be either in web, mobile app or both. This is done via meta key. When shown only in mobile app mode, then its hidden from web. The plugin code, that ...
0
votes
1answer
16 views

Custom attachment function not working in v5.4.2?

I have a function that I re-use in a number of custom themes when required to fulfil a customers need. I understand this can be achieved now with repeaters in ACF Pro but as I had a working function, ...
0
votes
1answer
47 views

Update Multiple Post Meta for the Same Post In One call?

How can I update multiple fields/Custom fields for the same post using only one call? Everything I came across are cases of multiple calls of "update_post_meta", for each of the fields. Is ...
0
votes
2answers
20 views

Can't save meta box data in Wordpress using custom post types

I've created a meta box. The code is: /** * Add meta box * * @param post $post The post object * @link https://codex.wordpress.org/Plugin_API/Action_Reference/add_meta_boxes */ function ...
0
votes
1answer
19 views

INSERT ON DUPLICATE KEY UPDATE failes in postmeta table

INSERT ON DUPLICATE KEY UPDATE Mysql query is not working with Postmeta table. It adds new/duplicate rows to the table. I couldn't find a way to solve this. I need to use this as part of a bulk import ...
-1
votes
1answer
14 views

How we insert values into database using metabox Wordpress?

function Review_Form(){ ?> <form action="" method="post"> <div class="container"> <h1>Add Review</h1> <hr> <label for=&...
0
votes
0answers
23 views

A better way to add a meta box to custom post types

Id like to customize the UI for adding and editing a custom post type such that each custom field is included as a separate input field on the "new post" and "edit post" forms (as ...
1
vote
1answer
39 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
0answers
11 views

add column to Woo-commerce dashboard order detail table

I have a custom field for every product in my store - package quantity. The price is set for a single item, not the package, and I'm multiplying the price by package quantity and then by product ...
0
votes
1answer
23 views

$post->post_meta not pulling any post in wordpress/php

I have a function in php as shown below: function hello_world( $post ) { echo '<pre>'; print_r($post); echo '</pre>'; // Line A echo '<pre>'; print_r($post->post_meta); ...
0
votes
0answers
66 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
0answers
28 views

Rich text (gutenberg) block not updating meta field

I want to save some HTML to my meta data using the rich text component. If the key does not exist, the rich text will create and save the key and value no issues. It will save edits as required; no ...
0
votes
1answer
54 views

Insert, update or remove data from database (usermeta)

I have a situation here. I'm writing a custom plugin for WordPress. I'm dealing with an issue: I'v created a metabox for Custom Post Type with add_meta_box and with a callback function where I ...
0
votes
0answers
22 views

How to securely controlling data without keeping it in postmeta?

I'm looking for another alternative instead of keeping the data in the post metain the post like plugin I developed for wordpress. I want to save the likes of the posts to a database and then show it ...
0
votes
1answer
23 views

show most viewed post

I have blog post counts which happen when a user views a blog post via ajax and the rest api. In the database I have a meta key and value like so: table: wp_postmeta post_id: blog post ID meta_key: ...
0
votes
1answer
29 views

Values from meta-box not on $_POST

I have a meta-box for a cpt and can't get the values from the form to update_post_meta cpt declaration: function hgod_fichas() { $labels = array( … ); $args = array( ...
0
votes
0answers
33 views

WooCommerce order refund get qty refunded

I have some custom meta data bound to a product which I want to increase the count of when an order is refunded. When a refund is issued you can of course only refund some or all of the total quantity ...
0
votes
1answer
14 views

After updating the custom post type, metafields disappear from the post.php edit menu, how do I fix it?

Internet does not have a solution for this specific condition. First I create a new post as below: $user_suan = wp_get_current_user(); $args = array( 'author' => $user_suan->ID, ...
0
votes
1answer
17 views

Add post meta data date to event

I created a post metabox that uses the datepicker to pick a date value. I got as far as adding the metabox and getting the datepicker to work but other than that im struggling to get the data saved ...
0
votes
2answers
68 views

Show the “ratingValue” and “ratingCount” values ​of KK Star Ratings Plugin

I want to display the "ratingValue" and "ratingCount" values ​​generated by the KK Star Ratings plugin (Github). I made a JSON-LD SoftwareAplication and here is the code I use in function.php: ...
0
votes
1answer
29 views

get_post_meta not working when variable used for post ID

I think I've read every suggested article on this topic and there are some similar but nothing seems to solve my problem. It seems like it should be simple. I just want to be able to use ...
0
votes
1answer
26 views

“BS_” rows in postmeta table

I am pruning my WordPress site's MySQL database and noticed that there are thousands of rows in the postmeta table with the prefix "BS_". BS_author_type BS_guest_author_name BS_guest_author_url ...
0
votes
0answers
14 views

Create static meta key-value pair

I want to store 66*2 css and js files content and select and add them in Wordpress postmeta, by save_post() hook. The css key/value pair and js key/value pair will be static, which will be added to ...
1
vote
0answers
19 views

Store multiple custom field as post meta per post(css, js, html, 2 link)

I want to make Wordpress faster. So, instead of using multiple templates, I want to put sidebar(html), small css file(syntax highlighter, prism.css css content as inline directly to post, to reduce ...
0
votes
0answers
13 views

No ACF post meta when using get_post_custom during save_post

When I save/publish a page, I want it to save to all blogs in multisite including its custom fields (using Advance custom fields). The problem is that, when I tried to look at the value of post_meta ...
0
votes
1answer
26 views

How to add a post's view count into the WordPress API response

This is my first time working with Wordpress APIs, and i'm not a PHP developer. Essentially our client just wanted us to display WordPress articles in our react-native app with simple data like the: ...

1
2 3 4 5
37