Stack Exchange Network

Stack Exchange network consists of 175 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 [wp-update-post]

The tag has no usage guidance.

0
votes
1answer
1k 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
900 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. ...
0
votes
1answer
27 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
18 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. ...
0
votes
1answer
50 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 = array( 'ID' => 45, 'guid' =&...
2
votes
1answer
412 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, ...
21
votes
8answers
25k 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
471 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
81 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 = $...
0
votes
1answer
483 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 = ...
5
votes
3answers
6k 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 ...
0
votes
0answers
23 views

2 pages falied to update after installing Gutenberg

I have been updating a ton of client's Wordpress sites to the newest version and all has been going smoothly except for this one. There are 11 pages on this site and all but 2 updated with no issues. ...
0
votes
1answer
668 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 ...
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 ...
5
votes
2answers
8k 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
38 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: ...
5
votes
3answers
17k 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
17 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
272 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
304 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
332 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
70 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
0answers
37 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
53 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
11 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
966 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 ...
2
votes
2answers
834 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 (...
1
vote
3answers
7k views

How Can I Set the Post Author of a Post I Just Created With PHP?

I'm using PHP to dynamically create a custom post, and I need the author to be someone other than the logged in user. I found this https://stackoverflow.com/questions/5759359/wordpress-manually-set-...
0
votes
1answer
24 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 ...
1
vote
3answers
432 views

Clear cache on post of one type when something happens to post of other type

EDIT: Based on @TimHallman's answer I have a follow-up question, please see the bottom of this post. I am trying to do something that is way over my head and the more I think of it, the more ...
1
vote
0answers
30 views

When User Meta amended update Title and Slug of Post programatically

I have this code below which works perfectly, i.e. when adding a new User a post is programatically created in my CPT. add_action( 'user_register', 'add_member_employees' ); function ...
-1
votes
2answers
2k views

Update post title from external file?

I have an external script I wrote (for admins only) that loads in the following at the top: require_once('./../wp-blog-header.php'); I'm aware that it can be a plugin, but it's just not right now.. ...
0
votes
0answers
197 views

Bulk Post update_post_meta

how can use this code for update just post_meta ? here my code : function update_all_posts(){ $args = array('post_type'=> 'post', 'post_status' => 'publish', '...
0
votes
1answer
50 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
112 views

wp_update_post ignores if/else

I have a function that publishes a post if it exists as a draft. But the wp_update_post function seems to ignore the if/else and runs before anything else. $post = get_posts(array( ...
0
votes
2answers
410 views

update flamingo_inbound post type after insert

I'm having a difficult time trying to update the flamingo_inbound post author after insert. Basically, I have a hidden field in CTF7 for the company name that is being sent over and correctly stored ...
0
votes
1answer
86 views

Mass Update lines of code for all posts

Bit of a conundrum today. I implemented some query string into my website so I'd like to retroactively update all my previous (600+) posts to update specific hyperlinks to include this query string. ...
0
votes
1answer
289 views

wp_update_post to set post IDs to drafts not working

Specifically WooCommerce Product Pages. I'm using WP_Query to generate the array. $params = array( 'posts_per_page' => -1, 'post_type' => 'product', 'orderby' => 'menu-order', ...
0
votes
0answers
367 views

$wpdb->update query incrementing value on it's own!

I want to get value of column and increment it by 1. After increment, update the value in column.For example: In column post_likes the current value is 4. I am incrementing it by 1(like this $var++). ...
0
votes
1answer
19 views

Front Page post mirroring revisions to other pages, constantly updating itself

The site I'm working on has a very strange problem. When any page is updated, the Front Page is updated with the same content. Changing what page is set to the 'Front Page' seems not to matter. I ...
1
vote
0answers
3k views

Set Attachment Image File URL as GUID

I have a form that uploads images and i want to update the GUID to be the attachment file url after WP generates the metadata. I tried to use wp_update_post, but seems that is not updating the guid. ...
0
votes
1answer
123 views

save_post affect creation and deletion

I wrote a little bit of code to update the post name and slug (of my cpt) when saving. This is working nice when I update a post. I just noticed theses few lines are affecting the creation and ...
0
votes
1answer
332 views

Use /prefix/postname as a slug in post_name?

I have a custom field that I would like to use as the post's slug. I'm able to get the custom field to be used as the slug for the post but I'm having problems attaching a /prefix/ before the postname....
1
vote
2answers
196 views

How to update all posts but the current one (post__not_in not working?)

I'm trying to unpublish (set post_status to draft) all posts when a new one (with specific conditions that don't really matter right now) is published. Here's what I currently have: function ...
0
votes
1answer
3k views

wp_update_post creating revisions instead of updating the post

I have been trying to update a post in the posts table but for some reason, it is creating a multiple number of revisions but not updating the main post. I have been trying hard for the last one day ...
3
votes
0answers
6k views

wp_update_post does not update post_name

I have a post with id=1, post_title = 'Some post title' and slug(post_name)='some-post-title. I want to update its title and slug. $update_args = array( 'ID' => '1', 'post_title' => '...
1
vote
0answers
174 views

how to transition to custom post status on post save

I'm trying to add a custom post status "Needs Review" for posts/pages that have been updated by an editor, so that admins can easily see what has been updated and review the changes. The planned ...
0
votes
1answer
390 views

wp_update_post meta causing 500 error

I'm troubleshooting a client site on GoDaddy and I have this strange issue that when I try and run update_post_meta the server throws a 500 error accompanied by this error message: Fatal error: Call ...