Questions tagged [wp-update-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
24 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
19 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
12 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
28 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
18 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
154 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
  • 255
5 votes
1 answer
167 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
0 answers
68 views

How to Auto Update Wordpress Post after specific time?

I hope you all are doing well. I need some help to update my post automatically after 1 year. I read alot of articles and hope this can be achive using wp-cron-jobs. Problem Explanation: Here are my ...
Developer Mohsin's user avatar
0 votes
1 answer
232 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
  • 205
1 vote
1 answer
926 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
73 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
157 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
601 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
259 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
709 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
123 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
78 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
290 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
321 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
176 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
115 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
137 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
256 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
917 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
22 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
302 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
103 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
630 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
725 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
514 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
159 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
692 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
725 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
219 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
442 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
1 answer
1k 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
157 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
78 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
2k 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
  • 301
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
382 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
47 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
0 votes
1 answer
2k views

Post meta data not showing in frontend, until hitting 'update' button

I try to insert around 2000 video-posts into WP. There is a custom field in the theme for the video-url, so I add the video-url to the post meta data with the corresponding field name. ACF seems not ...
rhyno183's user avatar
0 votes
1 answer
3k views

Inline style HTML attribute is being stripped from all elements of a post

I am attempting to publish HTML generated from an external party within Wordpress, but I am getting very inconsistent results with style attribute on all HTML elements, in that if I programmatically ...
Mattisdada's user avatar
1 vote
1 answer
1k views

What's the proper way to use a custom table? [closed]

I manually added a table to my wordpress database using sql using CREATE TABLE. I want to add functions for adding, modifying, and removing the data from this table just like with wp_update_user(). ...
ellen's user avatar
  • 345
2 votes
1 answer
717 views

Can I edit the wp_post > post_content right before its inserted/updated?

I would need to apply some sort of encryption on whatever gets inserted in the wp_post > post_content, so I was wondering if there is a way, either modifying the core (rather not), or using some ...
Pavel's user avatar
  • 23
0 votes
1 answer
438 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 ...
Jillian Hoenig's user avatar
0 votes
0 answers
35 views

recursively update content

the problem I'm trying to translate a wordpress 4.7. But the site was consived in spanish and just now I installed the WPML plugin, now after 5000 post uploaded. I am using the visual composer and ...
ValRob's user avatar
  • 113