Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [wp-update-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

Wordpress additional update of publications after importing WP All Import Pro

I ran into a problem updating records after importing WP All Import Pro. In general, when I do the import, the records are saved, everything is OK. I have fields created via CMB2. In one of these ...
Givanni Dev's user avatar
0 votes
1 answer
34 views

How to Programmatically Trigger the Update of a Post in WordPress?

I'm working on a WordPress project where I need to programmatically trigger the update of a post in the backend. The goal is to have WordPress process and update custom fields as if I had clicked the &...
Ahmed C's user avatar
0 votes
1 answer
12 views

Why isn't my embed_video WYSIWYG field updating when using update_post_meta?

I'm running a program which merges two posts together and each of their meta fields. I have a for loop that gathers each meta field and saves it. All of them work perfectly except for one called '...
DJZEEGLER's user avatar
  • 119
0 votes
0 answers
21 views

wp_insert_post() function doesn't create posts after I deleted the first created Post by this function

I have wroted a function and hooked it to set_user_role action hook. here is my snippet: add_action( 'set_user_role', 'createTeacherPage', 10, 3); function createTeacherPage($user_id, $...
ata ashrafi's user avatar
0 votes
1 answer
14 views

BuddyPress Edit activity function good practice

I am using a custom BuddyPress edit function. However, I was told this is a bad practice and that I should use WordPress's helper function. How to correctly do this? Here, is the code: add_action('...
Rohit kc's user avatar
1 vote
0 answers
19 views

Changing Post Status from Pending to Publish twice daily

I have setup a function to change post status from Pending to Publish for posts in a specific category. The function works perfect if I run in under init, but doesn't work correctly if I run under a ...
jberg's user avatar
  • 11
0 votes
1 answer
35 views

Set limitations of wp_update_post()?

I use Polylang on my site I set this function wp_update_post() to update two-time fields for my all Post Language when I click to update and publish again defualt post. I'm trying to use the following ...
SS Apps's user avatar
0 votes
1 answer
88 views

wp_update_post breaks my function

Good evening! I'm trying to adjust the post title + some ACF fields after a user have submitted a custom post type ('booking'). The function I've created almost works! The only problem is that ...
joxyzan's user avatar
  • 13
1 vote
0 answers
45 views

How do I get my Gutenberg element to prevent last modified from updating?

I've added a checkbox on my Gutenberg post, that when checked, is supposed to prevent Gutenberg from updating the post's post_modified and post_modified_gmt columns. The checkbox manages its own state,...
John Doe's user avatar
  • 287
0 votes
0 answers
24 views

Insert attributes names according to language with polylang programmatically

This is my problem. I try to insert in _product_attributes meta_value field the names of each language. When I print out my query, I am getting only the products in the right language, so ...
Rich's user avatar
  • 1
0 votes
0 answers
56 views

Trying to add a wp block and update the post content using PHP (wp_post_update)

I'm looking to write some PHP code that will be capable of looping through all of a certain custom post type and adding a specific block to the post_content, and then updating the post. For testing, I'...
Jordan K's user avatar
0 votes
0 answers
23 views

Updating post_parent caused the website to become unresponsive for 40 seconds or more

I am building a WordPress plugin the sets the post_parent of a post to the id of a custom post type called series. However, once I click update on the post it successfully updates the post and the ...
Petar Vasilev's user avatar
0 votes
1 answer
253 views

Set post status to draft after validating post meta values in save_post hook

I have some custom meta values to a custom post type ('event'). The custom post type is displayed in the admin and the custom meta fields are appearing fine. I am using save_post_{$post->post_type} ...
sariDon's user avatar
  • 265
5 votes
1 answer
194 views

Bulk post approval and publishing doesn't work

I'm new to WordPress plugin development. I'm trying to develop a simple plugin that creates a sub-menu named Approval under Posts menu and checks if any draft post has the post meta approve set to ...
Karma's user avatar
  • 176
0 votes
1 answer
384 views

How can I use wp_after_insert_post with $current_screen?

I'd like to call add_action( 'wp_after_insert_post' on particular screens. I'm currently checking the page like so followed by calling the wp_after_insert_post hook. It doesn't seem to fire but does ...
Motivated's user avatar
  • 215
1 vote
1 answer
1k views

Update post / page using API + python

I'm trying to update posts using python and API, the issue that I keep getting code 200 but the post doesn't actually get updated! here is my code: import requests import json import base64 url ='...
Fadi's user avatar
  • 73
0 votes
1 answer
81 views

Suitable hook when creating, updating and deleting posts programmatically

I am trying to create, update & delete posts programmatically from an API endpoint inside my plugin. My idea was to display these posts later on a dedicated page. Here's what I've written so far: ...
tearswep's user avatar
0 votes
1 answer
207 views

Trash Bin for Categories?

I have a cat_notice taxonomy, where there are several categories and one of them the slug is 'trash'. In this case I created a link and I needed that when I clicked on this link I would take the ...
Felipe Lenin's user avatar
0 votes
1 answer
674 views

$wpdb->update() always need a second try

I will use a custom endpoint of REST APi to update fields in a custom table. Therefore, i wrote this function: function update_table_single($request = null){ global $wpdb; $data_key = trim($...
kolja's user avatar
  • 103
0 votes
0 answers
313 views

Prevent other hooks from firing after wp_update_post() outside of editor

I'm working on a plugin that batch updates post content using a call to wp_update_post(). This all happens outside the editor window, in a batch processing script. My problem is that ACF is firing ...
Chris J Allen's user avatar
0 votes
0 answers
801 views

Set post publish date by custom field

I created custom fields with ACF to define a new date for my post on wordpress. I then created this function that updates the date with my custom field and works when I update a post. // Save ACF ...
Thompson1977's user avatar
0 votes
1 answer
167 views

Is it possible to "Update" pages via SQL?

How can I "update" a page in WordPress using MySQL? I.e., effectively click the "update" button in the page editor using MySQL? But not make any changes to the page? What I'm doing:...
BlueDogRanch's user avatar
0 votes
2 answers
2k views

wp_update_post does not change post status from draft to publish, returns 1

I'm writing a post approval utility for the front end, because we don't want our editor to be able to access the admin dashboard. There are questions on Stack nearly identical to what I'm trying to ...
TARKUS's user avatar
  • 137
0 votes
1 answer
88 views

Why does wp_update_post causes white screen?

I made a custom post type, named "Foglalás". Each post in the Foglalás post type has neither title nor permalink. All of them are kind of Auto Draft after saving. So, I would like to get the ...
Jani's user avatar
  • 15
0 votes
1 answer
419 views

Updating a custom post status after an expiry date rather than trashing it

I have set up a custom post type of featured products. Within that post type I have a custom date field for an expiry date. Currently when the date expires, the post gets moved to the Trash. I'm ...
Adam's user avatar
  • 111
0 votes
0 answers
370 views

Update post meta is slow while saving post

Post saving took much time. I have action to save custom metas using update_post_meta add_action( 'save_post_property', 'propertys_save' ); function propertys_save($id) { foreach($_POST['meta'] as ...
user2455079's user avatar
1 vote
0 answers
228 views

Allow Post Author to be 0 on Update

I have a custom post type that allows registered users to submit videos to my site. I have modified the script so that non-logged in (guest) users can also submit videos. I've added first-name, last-...
bowlerae's user avatar
  • 111
0 votes
0 answers
123 views

Run a function when a custom post is update?

There is a custom post type. Each post has a repeater field. When a post is updated, I need to get a value from the repeater field and insert it into a custom table in the WordPress database. To do ...
Sabbir33's user avatar
  • 103
0 votes
0 answers
159 views

Taxonomy Child Not Updating Unless I Click Update Twice

I am using code from this answer to create a new child taxonomy term, however for some reason the change only takes effect if I click update post twice. Clicking Update Post once doesn't save the ...
harvey's user avatar
  • 215
0 votes
0 answers
292 views

Cannot update newly added User field using wp_update_user

I want to add a new attribute to the wp_user table, "twitter_id" for example. I added the new column to the wp_user table, and it is added correctly. I get the current user (as I want to ...
DjangoBlockchain's user avatar
0 votes
1 answer
1k views

Update post if exist from PHP

I want to publish post from php for automation reasons with dynamic data and cronjob. I have almost succeeded, you could say that it works, but in an incorrect way. If the title doesn't exist, create ...
JonatanPN's user avatar
0 votes
0 answers
23 views

Update post "A" on comment submition on post "B"

Hello and thanks in advance for any help. Im trying to update the post status from a post when submiting a comment on other post, I have a variable in the url pointing to the ID of the post I want to ...
AHrtzt's user avatar
  • 13
0 votes
1 answer
355 views

wp_update_post gives 500 internal error

i'm editing a wordpress plugin and im trying to call a function within the thank you page, and in that function it has wp_update_post function to change the status in the database, the function works ...
omarhabeh's user avatar
1 vote
0 answers
105 views

How to bulk edit image url in featured image and product description?

I have tried a few plugins (free) but none update the url in featured product image and product descriptions. How can I update in bulk instead of doing one by one? If there any any plugin (...
Organic Heart's user avatar
0 votes
1 answer
659 views

update_post_meta not working with transition_comment_status

I'm trying to save an average of comments as a post meta that needs to be updated every time according to comment status. /** * Gets comment average data. */ function sw_get_averagerev( $post_id ) ...
Bikram's user avatar
  • 338
0 votes
2 answers
741 views

Custom Meta Box (SELECT2) Not Saving Taxonomy Terms

I have the code, /* * Add a metabox * I hope you're familiar with add_meta_box() function, so, nothing new for you here */ add_action( 'admin_menu', 'rudr_metabox_for_select2_cat' ); function ...
Mohammad Mehedi Hassan's user avatar
1 vote
1 answer
535 views

How to get the Tags on Publish post hook?

Requirement: On the each publish/update post, we need all tags from the post and do some functionality on that. Case 1: Create post, add tags and Publish immediately === WORKS PERFECT === Case 2: ...
Prashant Patil's user avatar
0 votes
0 answers
162 views

update_post_meta not working in template_redirect action

I have a problem I'm trying to listen to a webhook, and I can do it, I check with the help wp_mail function and I get all the data But I want to make a add data in the database, and for some reason ...
Сергей Сокол's user avatar
0 votes
1 answer
729 views

wp_trash_post() duplicates post to trash

I'd like to move a post to the trash in the loop. Here's my code; function run_every_five_minutes() { global $post; $wp_query = new WP_Query(array('cat' => array(1), 'posts_per_page' => ...
Kevin S's user avatar
0 votes
1 answer
736 views

wp_insert_post($post), add an array of values with update_post_meta

i try to store an array in multiple custom fields via post creation (wp_insert_post). The array is $event_test and the key is event_test on the meta_input. On form submit, the custom field is shown, ...
LovinQuaQua's user avatar
0 votes
1 answer
230 views

Change the term based on the value of a $variable using wp_update_post in submitting a form

Background I am using a fronted form to submit data to a meta box by use the wp_update_post to a custom post type (call) with a custom taxonomy (call-type). It then also updated the terms and ...
MFWebMaster's user avatar
0 votes
1 answer
474 views

Update post (published) date when changing category

Is there a way to update a post (published) date when you change the category/taxonomy to a specific one? Example: - Post type "Projects" - 2 categories: Progress/ Done When you change the category ...
Danny's user avatar
  • 13
0 votes
1 answer
1k views

How can I trigger a javascript function after a post update on edit post screen in wordpress admin panel?

I use Wordpress 5.2.2 and I develop a custom theme. EDIT : On my theme I added a metabox who show an input type="text". Code in functions.php of my theme if ( ! function_exists( 'vn_add_metabox' ) )...
Nouniz's user avatar
  • 17
0 votes
2 answers
2k views

Set a post expiration and delete a post when expirate

I'm trying to create a function that allows me to delete an article when the date of the day is equal or superior than a date filled in a custom ACF field. I wrote the function below that I placed in ...
willwoody's user avatar
0 votes
1 answer
165 views

Update all WordPress posts's title and content then display them in a table

I am trying to update all the WP post title and content then show the just updated post to a table. I am using the following code but it does not work: $args = array( 'post_type' => 'post', '...
David Nguyen's user avatar
0 votes
1 answer
85 views

Update around 200,000 posts

So I have recently migrated from a regular site to a wordpress CMS all via MySQL. I successfully was able to adapt the old database with that of WordPress. Now, the site has content in 3 languages. ...
Byte IT Antwerpen's user avatar
4 votes
1 answer
3k views

Why wp_update_post() does not update GUID?

Trying to update GUID on a attachment using the wp_update_post() function but its not updating GUID nor its throwing any error. Example code: $post = [ 'ID' => 45, 'guid' => 'https://...
Harry's user avatar
  • 311
0 votes
1 answer
2k views

Update status, meta while inside a post using AJAX button

So I am trying to click a custom button I made in a meta box the fire off AJAX. All works except getting the ID of the post and the refreshing of the page. I have tried using global $post; $post_id = $...
samjco-com's user avatar
0 votes
2 answers
405 views

How to automatic update date and time when save custom post type

I need to update date and time when I save posts. I see the code on the following thread, but I need to have this trick only for posts contained in my custom post 'new_cpt' Is it possible? ref: ...
Giulio's user avatar
  • 51
0 votes
1 answer
53 views

How to update the children of a post?

i found nothing about it in the WP reference and Google, so i ask you: I want to update a post by a form - and with it its children. $post = array( 'ID' => $mainid, ...
Plato's user avatar
  • 3