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
12 views

Branch made by several custom values

Below code from function.php works fine when the custom value used for conditional branch is only one. This code means if custom key A is AAA, update custom key B as ZZZ. if(get_post_meta($post->ID,...
0
votes
0answers
10 views

Being able to link a post to a custom id

I am not sure if this is something I can achieve and if so how to start the approach so am looking for guidance. My site is using am external API json request to gather data for football(soccer) ...
0
votes
0answers
8 views

save metabox value in another post when current post published or updated

I create 2 custom posts (CPT) - Series and Episodes, and added metaboxes using CMB2 cmb2-attached-posts. In Series, the metabox name is episodes_id and in Episodes, series_id. In Series, I can add and ...
0
votes
1answer
22 views

How to improve my non-unique metadata MySQL entries?

I'm working on a plugin for WooCommerce which uses a cpt called Restock. In a Restock post you can enter products ( id ) plus restock. The user can add as many product restock pairs as they want per ...
1
vote
0answers
32 views

How to add custom metadata text box dropdown to sidebar in Gutenberg editor for all post types

I am looking for how to add a custom dropdown on the right sidebar of the Gutenberg editor. I would like to do this within the functions.php of my custom theme, not with a plugin. The dropdown would ...
0
votes
1answer
16 views

register_meta not showing custom post type metabox data in rest api

I have added a custom post type and I want to expose the custom field value in the rest api. As per the docs register_meta can be used. I have created a custom post meta box using the wordpress way. ...
0
votes
0answers
23 views

Removing Malware

I've been asked to remove some Malware from a friend's site. I've found some wonky links in the wp_postmeta table, but the post_id that the field is associated with doesn't exist - and, weirdly, it's ...
0
votes
0answers
28 views

Cannot edit post meta fields with rest API

I am using python to send POST requests to /wp-json/wp/v2/< post type >/< post id >. This successfully updates standard fields such as title, content etc. However I am unable to make any ...
0
votes
0answers
10 views

How to update custom post meta via rest API [duplicate]

I am using python to send Post requests to /wp-json/wp/v2//. This successfully updates default info such as title, content etc. However I am unable to make any changes to the custom theme meta data ...
0
votes
0answers
11 views

How to get the same post_meta-field (custom field) for several different posts, with one database-call

I have the ID of a lot of different posts (50+). And I would like to get the custom field by the name: custom_excerpt for all of these posts, with a single database call. How do I do that? I'm using ...
0
votes
1answer
13 views

Add post meta fields, when creating a post using WordPress' REST API

In the documentation for /posts for WordPress REST API it states that I can add a meta-field. But it doesn't say which format that should be in. I can find other guides showing how it should be if ...
1
vote
1answer
27 views

WP_POSTMETA changes site crash

I try to update wp_postmeta from SQL script. This is my original row in table: a:7:{s:16:"lambda_page_item";a:24:{i:0;a:9:{s:9:"grid_size";s:3:"940";s:7:"boxname&...
1
vote
0answers
31 views

How to display the “ratingValue” and “ratingCount” values ​generated by the KK Star Ratings plugin into my page's recipe ld+json schema

I'm trying to add ld+json schema markup to each recipe page on my site that will automatically pull over the most up to date aggregator rating data (from kk star ratings). I came across this post (...
0
votes
0answers
14 views

Update a text field in a block when saving a post?

I'm updating my theme to work with Gutenberg and I'm having a problem updating a text field in a block when saving a post. In my old theme, I had a function that updated a text field in a metabox when ...
0
votes
1answer
13 views

I Can't get the post_tag name from term_id using wp_set_object_terms

I use https://rudrastyh.com/wordpress/select2-for-metaboxes-with-ajax.html. I want to display the name of post_data inside widget tags of posts and mainly tags column inside posts list. I can't get ...
0
votes
0answers
18 views

Add an embedded Youtube/Vimeo thumbnail to OG image? Open Graph

Noob learner here. As the title really, i need to be able to add the thumbnail of embedded Youtube and Vimeo videos to Open Graph? So that when shared on Facebook it shows the embedded video thumbnail....
1
vote
1answer
70 views

Update Post Meta for a logged in user

I have created a form which collects information which I want to update a post with. The code I have works great, but instead of updating a post for the user, it creates a new one. Not sure what I am ...
0
votes
0answers
24 views

Show custom fields in Post Grid

I have created custom fields for my posts and I want to show them in the post grid. Here is a picture of where I want to add the custom fields to be shown How can I do that? Do I need to use code? ...
0
votes
0answers
17 views

Getting meta in editor plugin, and event triggering issue

I have a Custom Post Type defined with custom-fields support. I then registered a meta field. The first issue is that select( 'core/editor' ).getEditedPostAttribute( 'meta' )....
0
votes
1answer
13 views

how to auto random increment for post view

i want edit this code to auto increment not just +2 for each user's click and instead increment number would be random ( + 2 , + 4 , ... ) if( $should_count && ( ( isset( $views_options['...
0
votes
0answers
10 views

update_post_meta broke url value

I'm having a problem, i have a post meta key, its value is a url like https:// .. like this but now if I pass the value to update_post_meta its saves it as "p" I check the wordpress codex ...
0
votes
0answers
6 views

Add Featured Image as Post URL Path Component Extension

I would like to append an extension component to my post URL that would allow me to get the featured image of a post while preserving the URL scheme. For example, if my final post URL was: https://my....
1
vote
0answers
28 views

WP_Query with meta_query for children

I'm using WooCommerce and it has a lot of plugins to handle different stuff. The one thing needed by the client that no other plugin manages correctly is which variations can be visible for each user ...
0
votes
0answers
4 views

I dont know why redirect from category to home page. please help me

below url is my website post breadcrumb. https://www.must1st.com/category/seo-insight/ but when I click the breadcrumb, redirect to home page url. how can I broken this redirection?
0
votes
0answers
19 views

Sort custom meta column by other meta value

I have a post type named "event" and I store two meta values for these posts: _start_time and _start_time_unix. The first one contains a string representation of a date and the other one a ...
0
votes
1answer
11 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
41 views

How to register post meta with multi level arrays?

I'm tringing to register post meta with object options under main object trim_levels to be used with REST API. register_post_meta('vehicle', 'trim_levels', [ 'type' => 'array', '...
0
votes
1answer
29 views

Sort by price wpdb

I have a page on my wordpress to search for tires everything works fine but I would have liked to know how to add an extra column to sort them also by price. They can already be sorted by size and ...
0
votes
1answer
28 views

Ordering posts by anniversary using only day and month

I defined a custom field named crimedate using standard date format Y-m-d. I defined the filters to make ordering by this date work in the post list of the backend, which works fine. Now I need the ...
0
votes
1answer
17 views

Do posts, pages and / or custom post type objects have unique ID numbers or can there be multiple objects with the same IDs?

What are the canonical rules for the ID numbers of posts, pages and CPTs? Especially as they are created programatically.
0
votes
0answers
43 views

update_post_meta() doesn't work with save_post action

I am trying to set a _stock_status post meta to 'outofstock' for each product and product variation when it is saved for the first time (not updated). This is the code: function save_product_meta( $...
0
votes
1answer
71 views

Ordering posts by custom field named “date” in backend

I defined a custom field named "date" and now want to order the post list in the backend by this field. I defined the filters to make ordering work and header is clickable and shows the ...
0
votes
1answer
28 views

What are the meta fields for an attachment?

I'm trying to find all the meta fields that are used for an attachment: like Title, alternative text, description and caption . I've looked all over and the only one I was able to find was for an ...
1
vote
0answers
38 views

How to modify a query in functions.php to involve both post_title and fields from wp_postmeta?

On my Fusion Builder powered WP website I have created a CPT called movies. The title of each post (i.e. each movie) has a post_title property which is located in wp_posts table, other custom ...
0
votes
0answers
29 views

Meta query ignores multiple values of the key

I have the following post meta for posts: _post_allowed_countries //Example value: array ( 0 => 'en', 1 => 'gr', ) // A list of allowed countries and _post_allowed_countries_not //Example ...
0
votes
0answers
37 views

Need to include wp_postmeta data from accordion in search results

Ok, so im using this accordion plugin below https://wordpress.org/plugins/responsive-accordion-and-collapse I need to search the wp_postmeta table to get data that is inside the tabs...Ill add a ...
0
votes
1answer
38 views

How is the author's name given a different color?

Author's and visitors' names use the same color in comments.The point here is that the color of the author's name is different in the comments. For example, in visitor comments, name is red. But, the ...
0
votes
1answer
20 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
15 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
21 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
17 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
18 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
10 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
12 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
25 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
73 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
9 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
49 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
21 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', '...

1
2 3 4 5
38