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
14 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 ...
-1
votes
1answer
19 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 ...
0
votes
0answers
20 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 ...
0
votes
0answers
13 views

How to make two different meta fields look for same thing

I am new to WordPress and working on an events management website. I am using a theme that looks for events data using some specific meta fields for e.g. event_start_date for start date of the event. ...
0
votes
1answer
22 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', [ $...
0
votes
0answers
15 views

add datepicker to post edtor

I've created a wordpress headless installation that rely on vuejs and REST api for the front-end. I need to add into the classic editor a datepicker to give the user the ability to select a date that ...
1
vote
1answer
16 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
0answers
8 views

Creation of a search page and event display with datepicker metaboxes

Being a beginner in the development of Wordpress theme, I'm currently trying to create a custom search filter on a dedicated event search page template. For this, I created custom fields of date ...
1
vote
0answers
24 views

Limit the number of acf content when displaying in post loop [closed]

I display post images by this way in the loop . <?php $images = get_field('POST-IMAGES'); $size = 'medium'; // (thumbnail, medium, large, full or custom size) if( $images ): ?> <ul> ...
0
votes
0answers
7 views

Custom Post type editing: where has my publish button disappeared?

I run a Wordpress website with a lot of Custom post types, where I customized the interface so that contributors can easily do what they need. When editing a given post, widgets appear on the second ...
0
votes
1answer
10 views

How to detect that the save_post hook is calling the callback associated to the current edit post page only

I am using the save_post hook to handle updates in a post that are done via the admin edit post page. But since I have more than ten custom post types, the save_post associated to each one of them is ...
0
votes
1answer
21 views

Change post author without using wp_update_post()

The standard or more obvious way to change a post author in WP is to use the wp_update_post() function, as shown in this question. But I am having an issue, described as follows: // Inside the ...
1
vote
0answers
14 views

changing meta value and meta key of price field

I have theme that uses price field. its price is stored in "S1" meta key. next is woocommerce that use simple _price meta key to tore price values. i want that when user enter price in theme ...
1
vote
1answer
22 views

Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)

I mean; There are more than 7000 posts. some have private space but some do not. I want to add a custom field in bulk to those that do not contain custom fields and update their values. The following ...
0
votes
0answers
32 views

update_post_meta() is not saving the value

I have been working on this for hours already but cannot manage to find a solution. I am using this code to save a value for a metabox: $fecha_proxima_revision = sanitize_text_field($_POST['...
0
votes
0answers
12 views

Posting to a Custom Post Type from front end - user generated content

Is there a fast and reliable way of posting to a Custom Post type from the front end? My use case is for creating a daily checkin for a fitness trainer. I have created the necessary fields using ACF. ...
0
votes
0answers
18 views

How to delete post meta array by value

I have three fields I am saving as an array to a custom post meta. Like such... <label>Member:</label><input name='cantcommit[mbr]' value='' /> <label>Arriving:</label>&...
3
votes
1answer
62 views

Should I sanitize custom post meta if it is going to be escaped later?

Firstly, sorry if this has been properly answered before. After reading a lot of questions and guides, I'm still not totally convinced on the best way of doing things. I understand the basics of XSS- ...
1
vote
0answers
22 views

Unset field from an array not working as expected

I'm trying to filter a custom options page from acf that is used to create menus based on items that are added on the backoffice, but I'm not being able to unset the fields when they aren't supposed ...
0
votes
1answer
20 views

Only show meta on one post type on search results page

I want to remove the post meta from all post types that are not "posts" from my site or at least from the search results. Im currently using the Jnews theme and in the search results page I ...
0
votes
0answers
15 views

Read / Watch / Listen times - meta

I have a website organised around three kinds of posts (categorised accordingly): "Read" "Watch" and "Listen". I want to have a read-time and watch-time and listen-time ...
0
votes
0answers
34 views

Add an action based on custom post meta field

I need to add every single post as a custom hook, in every post I have tow field, mycode will be code content and need to hook it to custom action, this custom action Ill get it from ...
0
votes
0answers
18 views

Save data is post using php front end

I'm newbie, i have a simple php file ,there is my data like, title, body content, feature image, category and 1 custom file I want to save this data in my post My coding look like this $title="...
0
votes
0answers
15 views

WooCommerce query produces out of stock products - Hide out of stock option ON

So, I've this website where I've set option in WooCommerce settings to hide out of stock products. When I load product category on the frontend, I get something like: showing products 1-16 of 350 ...
0
votes
1answer
29 views

Ajax: Populate <div> with content from a post's ID not working - duplicating current page html instead

Ok guys and gals, I'm losing my mind here... I am looking to append the content and a custom field of a post to a div on page. The ID of the content and custom field is defined by a data attribute on ...
1
vote
0answers
17 views

Update post_meta with WooCommere variation data

Iam having a product with multiple variations. I created custom fields which will show up in the settings of each variation. These fields should hold/duplicate some variation data. Iam having trouble, ...
1
vote
0answers
50 views

What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)

I have a search plugin that can search serialized metadata as well as categories (for multi-checkbox). Is there any advantage to using serialized post metadata instead of creating a custom taxonomy ...
0
votes
0answers
20 views

Why is this post index displaying the first letter of posts (as it should) EXCEPT for “B”?

Hopefully this is considered on-topic. It has to do with a plugin, but only one small part of a plugin, which I've modified. I'll try to keep this short. I have a blog at https://www.writesofway.org/....
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";...
3
votes
1answer
86 views

How Can I save multiple records in same meta key?

I want to save multiple dates in meta key. I have a three dates 2,3,4 and I want to save all these values in same meta key but as a different values. For example: dates(meta key) 2(meta value) dates(...
1
vote
1answer
21 views

Fetch Record based on meta key dates

I want to write a query which fetches the data based on my meta key added. Meta key name is 'repeater'. This is my POST META. Serialized: a:3:{i:0;a:3:{s:9:"postdates";s:10:"2021-02-02&...
0
votes
1answer
14 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
12 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
25 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
1answer
35 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
34 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
29 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
37 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
12 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
2answers
50 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
29 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
50 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
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
30 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
32 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? ...
1
vote
0answers
24 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
14 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['...

1
2 3 4 5
38