Questions tagged [wp-update-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
3answers
28k views

wp_update_post() example… how to update the_content in a textarea?

I am using the below function to update the post meta from the front end. How can I add add best a textarea that updates the_content() using wp_update_post()? if ( isset( $_POST['albums'] ) &&...
1
vote
0answers
10 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 (...
3
votes
1answer
477 views

How can I stop wp_update_post messing up HTML example code?

I'm showing little pieces of example HTML/PHP code on the frontend (with syntax highlighting). The entries are displayed as FAQ custom posts, and have a plugin (CMS Tree page) to alter the menu order, ...
1
vote
1answer
659 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 ...
0
votes
1answer
73 views

Cannot update page - with too many characters?

I have problem with page update. I am tring to save more than 14230 characters. After "update" worpress is moving me to "Posts" page. I show this issue on this video: https://youtu.be/3Y8qgFEizBU ...
0
votes
1answer
22 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 ) ...
2
votes
3answers
1k views

Updating a post without escaping ampersands?

I've found that wp_update_post() escapes all ampersands provided in the post's post_content. I'm trying to update a post without converting ampersands to &. (I need to add plaintext URLs (...
0
votes
0answers
7 views

SQL: trying to update posts that have certain custom meta

struggling with an SQL command.. I want to change a post type from 'post' to '2month' that have custom meta (low_jobs = 'under 100') and do not have certain categories UPDATE wp_posts.ID SET ...
0
votes
1answer
567 views

Updating post_parent by id (many times)

How can I update post_parent by ids? I tried: add_action('init','updating_parent'); function updating_parent(){ $args = array( 'post__in' => array(208,51) ); $my_posts = ...
0
votes
0answers
17 views

Change Human Time Difference Number Language

I have added function /* Function which displays your post date in time ago format */ function human_time_diff_nepali( $from, $to = '' ) { if ( empty( $to ) ) { $to = time(); } $diff = (...
3
votes
1answer
543 views

Why wp_update_post() does not update GUID?

I'm trying to update GUID on a attachment. But somehow it's not working neither it's throwing any error. Example Code: $my_post = [ 'ID' => 45, 'guid' => 'https://example.com/foo.png'...
0
votes
0answers
10 views

Log validation information

When updating a post I get the following error message. Validation failed. 1 field requires attention I cannot deduce from the user interface which field requires attention. The field may not be ...
5
votes
5answers
20k views

Post/Page Publish/Update button not clickable once I make an edit

I open a page and make an edit and the update button becomes grayed out. I have to copy all page content, refresh the page and paste it back in the page, only then does the update button become ...
0
votes
1answer
843 views

Update button (sometimes) greyed-out

I'd say about 50% of the time when I edit a post the 'update' is greyed out. What I do is copy the mark-up, refresh then re-apply and publish which is a bad work-around because it doesn't address the ...
0
votes
0answers
16 views

Sql query to update urls automatically for future posts?

how can i update one url to another for upcoming post automatically. For ex. if "google.com" appear in any upcoming post update it automatically to "fb.com". Any code or plugin to do that ? btw i ...
0
votes
0answers
16 views

Custom Meta Box (SELECT2) Giving Wrong Taxonomy Tag

I have update this code, Category taxonomy working fine, but tag taxonomy not working. /* * Add a metabox * I hope you're familiar with add_meta_box() function, so, nothing new for you here */ ...
0
votes
2answers
57 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 ...
0
votes
1answer
1k views

SQL / wp_update_post: change post custom field to CPT post taxonomy

the setup is as follow: I have posts with a custom field: actor = 'tom hanks' for advanced management I created a custom post type (actors) and added "tom hanks" as a post within that actors taxonomy. ...
1
vote
1answer
42 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: ...
0
votes
0answers
30 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 ...
0
votes
1answer
40 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' => ...
0
votes
1answer
363 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' ) )...
0
votes
3answers
3k views

wp_update_post on specific custom post type

first of all, im sorry for my poor english, when i upadte a post this code changes the post slug to a "profileid" costom field value.. add_action('save_post', 'my_custom_slug'); function ...
0
votes
1answer
38 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, ...
2
votes
2answers
787 views

Update post date on every new comment?

I would like to update a post on every new comment, so that the Last Modified Date is always up to date on the sitemap. How can i do this? Thanks.
4
votes
5answers
12k views

wp_update_post() doesn't update post_status?

I'm using this bit to insert/update a custom post type from the front-end. The date is set from a custom jquery datepicker. if (strtotime($date) < strtotime('tomorrow')) { $...
0
votes
0answers
49 views

Changing the “Post Published. View Post” admin notice message after running `wp_insert_post_data` filter

I am running a validation logic for when a user is attempting to publish a post, the validation is made possible using wp_insert_post_data filter. If a user wish to publish a post, the filter will ...
0
votes
0answers
33 views

Pass post ID to wp_update_post

Need your help. I have created a custom post type and have a list table of the latest 10 posts. I need to change the post status of those post which I check a checkbox. However, I can not figure out ...
0
votes
1answer
3k views

How to change post status from “draft” to “publish”?

My script uses code to set post content. I am also running the WP To Twitter plugin, to auto-tweet those posts. The problem is, whilst the plugin is correctly formulating its tweets using the default ...
0
votes
1answer
34 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 ...
0
votes
1answer
41 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 ...
0
votes
1answer
75 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 ...
0
votes
1answer
41 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', '...
0
votes
1answer
26 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. ...
21
votes
8answers
29k views

Check for update vs new post on save_post action

Is it possible within the save_post action to determine whether it's a new post being created or an existing post being update?
0
votes
1answer
779 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 = $...
6
votes
3answers
8k views

Connection lost. Saving has been disabled… (Updating Posts/Pages)

I've been developing for Wordpress for a few years now without any trouble on an old XP/WAMP development server (v1.7.4) but recently have been getting the error "Connection lost. Saving has been ...
-1
votes
1answer
2k views

Fatal error: Call to undefined function wp_cache_get after update attempt

I received the following error after attempting to update my WordPress to the latest version Fatal error: Call to undefined function wp_cache_get() in /home/fairmftt/public_html/wp-includes/option.php ...
1
vote
2answers
2k views

wp_insert_post_data filter hook identify current action

I have this function to set the title of a wordpress post which works properly for saving / updating posts. The major issue is that the function stops posts being deleted (it removes the title but the ...
7
votes
2answers
11k views

Programatically change post author

Given a user id, $user_id, and post id, $post_id, how can I programatically update a wordpress post author? Note: these posts are already created and the author cannot be set upon creation. Another ...
0
votes
2answers
54 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: ...
0
votes
1answer
23 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, ...
0
votes
1answer
578 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 ...
0
votes
1answer
1k 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 ...
1
vote
1answer
520 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(). ...
2
votes
1answer
197 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 ...
0
votes
1answer
117 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 ...
2
votes
4answers
5k views

Unable to modify(update) posts - Page not found

For couple of days I am experiencing issues with modifying some of my posts. When I try to modify the content of post, I get 404 error, redirecting me that page is not found. Doing Google research, ...
0
votes
0answers
18 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 ...
2
votes
1answer
1k views

wp_update_post based function works on existing posts, but not new posts

I have a function that will update the title of the post based on an 'advanced custom field'. It works on existing posts, but not when I create a new post. When I try and save the post and check the ...