Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [update-post-meta]

The function update_post_meta() updates the value of an existing meta key (custom field) for the specified post.

0
votes
0answers
13 views

I can't update my meta box with multiple fields

I successfully build a function, that is able to import data from a CSV into posts of a custom post type. I am able to parse data into the native title and description field, but when I want to parse ...
0
votes
0answers
12 views

Editing post_meta from phpMyAdmin is not taking effect in the site

When I edit post meta value from database, it is still showing the old value on the front-end. Though, it shows my updated value in the edit post section, but in single.php it still shows the old one.
0
votes
0answers
28 views

Custom meta POST request fired twice when updating a post in Gutenberg

I have made a feature similar in behaviour to Revision Notes, but for Gutenberg. It is a Gutenberg sidebar plugin which adds a text field where users can write an edit summary when they edit a post, ...
1
vote
1answer
24 views

403 Error when text is pasted in Custom Metabox Textarea

I hope everyone is having a great day! I am creating this question as I have been stuck on this issue all day and I need some friendly advice. I have created a repeater custom metabox item for a ...
0
votes
1answer
34 views

How do you update post date (year only) in a separate custom field?

I would like to update all my posts with a custom field that stores the year the post was published. The "year" value will obviously be retrieved from the post's date meta data. I will then use the ...
1
vote
2answers
35 views

How to upload multiple image using wp_insert_post

Im using wp_insert_post to add products on the front end of a woocommerces site My current code will upload all the images but only the last image will be in the product gallery images heres my code;...
1
vote
3answers
243 views

update_post_meta() not working when used with WordPress action

I am trying to update the field when post status changes to published. It is getting the values properly but not updating when I check the what update field is returning. It shows some number. ...
0
votes
1answer
94 views

Does “update_post_meta” check if value is the same before updating?

When running the following code: update_post_meta( 1, '_visibility', 'visible' ); Does wordpress check to see if post_id 1 key _visable has a value of visible before writing to database? I have an ...
0
votes
2answers
47 views

WP cron and update post meta

I try to create a scheduled cron job which runs every hour, Its my first time working with wp-cron. In the cron function, I want to update post meta values, if some conditions are met. I also tested ...
1
vote
1answer
19 views

How do I set all of a particular post meta to a value within the custom post type I'm in?

I've currently got a custom checkbox that (if checked) sets a particular post as 'featured'. It also set all other posts as 'unfeatured', just before setting the current post. This has worked great, ...
0
votes
1answer
23 views

Add postmeta to all blog posts

I have a bunch of blog posts that I need to update with a custom postmeta key/value pair. Therefore I have two questions - where can I find the postmeta entries in a worpdress MySQL database and how ...
0
votes
1answer
109 views

Rename image filename using 'media_handle_upload'

I need to rename images uploaded by the user when they post on my site. I have a code that works perfectly to save the image and make it part of the post. But I want the images to be renamed to have ...
0
votes
1answer
100 views

Update meta_value in wp_postmeta using API

I am trying to update a specific meta_key field using an API. meta_key name is _yoast_seo_redirect. it contains a redirect URL which we give in post options within wordpress. What I am trying to ...
0
votes
1answer
155 views

update_post_meta() with a modified array?

When in wp-admin I want to manipulate one value of an array and then update the post_meta with this array. My array looks like this: 1285 array(1) { [0]=> array(2) { ["description"]=> ...
1
vote
0answers
43 views

update_post_meta saves nothing in database when run in publish_post

So I have a little function that runs successfully in with publish_post. This is the code: function socialOverlay( $ID, $post ) { $name = 'myname'; $email = 'myname@gmail.com'; $to[] = ...
0
votes
0answers
22 views

Programmatically create draft of existing post

Hi wordpress community, What I am trying to do is programmatically create an updated draft (not live) of a published post - so that the changes will be recorded but not published. Right now, my ...
0
votes
1answer
80 views

update_post_meta doesn't work

I've been drilling with codes for so long. I was trying to create a metabox with a simple textare on it. Been stuck for almost 10 hours tyring to solve this. Still up until right now my meta box ...
0
votes
1answer
35 views

Frontend form with multiple posts

I've been researching frontend post-editing/creating forms, but I can't seem to find anything about having multiple forms on the same page. Please excuse my shaky understanding of POST methods. Here ...
0
votes
1answer
16 views

How do I update a specific value within array in a products metadata?

Im trying to update a products meta information with values from a calculation. Back story is that we are selling parking spaces for an airport and the current system we have in place is that a ...
0
votes
0answers
50 views

When working with a post, almost all wp_postmeta are deleted

Almost all wp_postmeta removed after updating, deleting POSTS or editing ACF fields, messages what could be wrong? If you export SQL tables before and after, you will get this: u.p.d A request ...
0
votes
1answer
134 views

update_post_meta in loop changing ALL values

I have a button on the frontend that updates the value of post meta on the backend, and it's nested inside a loop. However, on submit it updates the value on ALL posts. What am I doing wrong? ...
0
votes
2answers
169 views

Updating post meta for checkbox

<div class="vp-field vp-checkbox vp-checked-field vp-meta-single" data-vp-type="vp-checkbox" id="_custom_meta[category][]"> <div class="label"> <label>Categories</label> &...
0
votes
0answers
40 views

Wordpress - update_post_meta won't save if empty?

Once I add any value into the field and trying to remove it it won't update until there is at least a one character (space). Is there any particular reason why wordpress won't save new value if empty ?...
0
votes
0answers
76 views

update meta data (like view counter) by rest-api

i want update view counter of post in app. i getting site data by rest-api to my app(created by ionic) ,but now i need update somethings like view counter that when a post viewed in app like site view ...
0
votes
1answer
97 views

wp_mail send email twice inside function updated_postmeta

I make a custom function so when postmeta updated to specific value i send custom email use wp_mail. email successfully send but it create twice at same time. here my code function ...
0
votes
0answers
47 views

Where am I going wrong acquiring the current post ID value in a function within functions.php

This is my code in functions.php - the only function herein ( 'the_some_meta_update' ) is trying to update the meta key 'license' of a certain custom post ( identified by $post_id ) with the post ID ...
0
votes
1answer
63 views

update_post_meta not working in foreach

To avoid adding post meta values one at a time (and reduce repeat code in my theme) I wrote a simple class to store all the options so I can iterate through. The class works fine and constructs an ...
0
votes
1answer
23 views

Updating my Post when expiry date is past

I have done some more reseach and come accross the following article which does exactly what I want it to do. According to the writer, the code works but when I try and adapt it to my circumstance it ...
0
votes
0answers
46 views

Im trying to supply the post ID to a plugin function in the plugin file. But instead of the value, its NULL

TY for opening my question! Im trying to update the meta key 'license' in a custom post that I have, with the ID of an existing WP post. So Im using a global variable to store the ID of the WP post ...
0
votes
0answers
42 views

Adding new field data is not saving into database in wordpress registration

I have been trying to add a field as password into wordpress registration form. It's showing in the database that specific user has password which is encrypted. But While I am trying to log in using ...
0
votes
0answers
175 views

update_post_meta() not updating

I'm saving API data as metabox data, and I'm attempting to update metabox data on import. So the Title, content data will always update. But I can't seem to be able to use the ID to update the metabox!...
0
votes
0answers
30 views

Update custom field on page specific to logged in user

I have a page that displays data specific to the user who has logged in--charts, etc. That works great. I have added a few custom fields on that page where I insert values using update_post_meta(). ...
1
vote
1answer
588 views

update_post_meta for custom field not working upon form submission

I have a custom field called _my_description The idea is when a form is submitted the data from the form is also put into this field. Here's my code add_action( 'gform_post_submission_10', '...
1
vote
1answer
98 views

Update postmeta Parent when post_status child change

I have custom status = completed. I want to set automatically when child post update status 'completed'. their parent's postmeta also change. here my code: add_action('save_post', '...
3
votes
1answer
64 views

Wordpress widget new instance creates content duplicates

I have a custom made widget that I wrote and I want to display two instances of the same widget in the same widget area. When I drag and drop new widget instance to the widget area inside admin panel ...
0
votes
2answers
2k views

Frontend Form Checkbox Update ACF Field

I've got a frontend form with text, select and checkbox inputs the text and selects update and work just fine, using update_post_meta() however the checkboxes aren't updating. Since they're stored in ...
0
votes
1answer
847 views

How to save woocommerce product?

I need to import products from third-party API to woocommerce. How to save data using wp_insert_post()? name = string sku = string type = string regular_price = double description = string weight = ...
0
votes
1answer
18 views

Updating Lat and Lng of posts automatically gives sporadic results

I need to update the lat and lng meta fields for my posts automatically, based on the address entered from a CSV import. For some reason, the number of failed updates changes sometimes when I run my ...
0
votes
0answers
19 views

Mark posts that have been updated for two weeks

I run a website where users post mods and thus the posts get updated from time to time as the authors make changes to them. I would like to add an "Updated" mark to a post that has been updated. But ...
0
votes
0answers
92 views

Hook after post was created to update Custom Fields

I'm tryin to update post meta after a post was created but the get_post_meta function is not working. I have tried transitions, and almost every hook from documentation. The save_post_post , ...
0
votes
1answer
58 views

Set the value of custom field when post is published or updated

I'm trying to set the value of custom fields when a custom post type ('film') is published or updated. The end goal is to get meta-data from an API based on a URL field when the post is published or ...
0
votes
0answers
24 views

Posting to list item with OptionTree

Having a bit of an issue trying to get this to work. I am submitting a form which is entering data into meta fields of a custom post type, so I have wp_insert_post set up and working, entering text ...
0
votes
1answer
401 views

How trigger to save post when updating post meta

I have very confused situation. I have added posts and all posts metas from one website db to another one, everything is fine, images, title, description of posts are there. But post metas are not ...
2
votes
1answer
78 views

Why is variable value emptry in $_POST but available in $_REQUEST?

I'm trying to add a custom meta box to my theme by following the tutorial : https://www.sitepoint.com/adding-meta-boxes-post-types-wordpress/. I can see the meta box and It gets the value from ...
0
votes
1answer
25 views

Is it safe to add a new field to meta_value field?

I'm trying to offload Wordpress images from my web server. I've successfully moved everything over to Amazon AWS and have a syncing mechanism in place that uploads new images to AWS. Now I would like ...
0
votes
1answer
251 views

update meta field value after

I am trying to update meta field value. Everything ok, problem is that field value does not showing in field after refreshing the page. For example, when I update name value then its does not show ...
1
vote
1answer
229 views

Assign category using custom field?

Is it possible to use a custom field to assign the post category? For example: I have Genres custom field to my custom post type Tvseries. Then i entered: Action, Drama, Comedy Once i save or ...
0
votes
0answers
311 views

How to debug 'update_post_meta' using AJAX to update a Custom Post Type from the front end

(This is a take 2, getting to grips with the Stackexchange formatting guidelines) I've successfully managed to create and update a CPT from the front end via a form. I need to do the same but now ...
1
vote
1answer
495 views

update_post_meta not working in save_post

I'm having an issue with a function i'm trying to create. It should be simple. When someone saves a post, grab the city/address/province and convert it to long/lat then save that to the database. The ...
0
votes
1answer
48 views

Custom meta box data not saving

I created this meta box for my custom theme. I thought I followed all the guidelines, but I'm hitting a wall. The meta box and all fields are showing, but when I update, the data is not saved. Meta ...