Questions tagged [wp-update-post]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
10
votes
2answers
9k views

How to avoid infinite loop in save_post callback

I have been using this site alot for solving my problems, but this time I did not succeed in finding and answer for my problem. I get and infinite loop when using wp_update_post inside a function ...
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?
3
votes
1answer
8k views

Automatically fill custom field value on post publish/update

I've searched around a bit, and I'm having trouble finding an answer to this question. What I'm trying to do is automatically fill a custom field when a post (custom post type) is updated or ...
4
votes
4answers
11k 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')) { $...
2
votes
2answers
5k views

How to batch update post content with custom post meta value

I have a custom meta box, using WPAlchemy, in which I am looking to get rid of. However, I would like to get all posts that have a specific custom meta value set, and insert it into the begininning of ...
4
votes
2answers
828 views

What are the limitations of wp_update_post()?

I have two fields in wp_posts table that wp_update_post() seems to be unable to change. I'm trying to use the following code: $echo $group_access; $echo $tag_list; $my_post = array( 'ID' ...
3
votes
1answer
274 views

Fill post titles from post content?

I imported over 1000 posts from a Tumblr gallery. All the posts are untitled, but each has a photo and name inside of the post. How do I make take the content of each post and make it the post name?
2
votes
2answers
417 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.
0
votes
3answers
3k views

I need to bulk update all wordpress posts on a scheduled time

I need to update all posts on my wordpress site on a scheduled time (every day). So I wanted to create a new page template which I can call everyday through a cronjob to update all the posts at once. ...
4
votes
1answer
3k views

Which action hook can I use when a featured image has been selected

I have made a plugin for wordpress which copies the image to another directory when a post has been edit. But if you only upload another featured image and don't save the post. The image has been ...
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
4answers
3k views

change a post status when users update posts?

Is there an efficient way to change a post status from 'published' to 'draft' when a user of a certain type tries to update their posts. I tried something along these lines function ...
1
vote
1answer
2k views

How to generate slugs?

I have the following situation. I accidentally updated post_name column in wp_posts tables for all rows. Now I need to update those back somehow. I have researched that WP uses this function to ...
1
vote
1answer
567 views

Error in WP_update_post

i make php file outside from wordpress folder to edit wordpress post and i get error when i use this code. wp_update_post <?php include '/go1/wp-includes/post.php';?> <?php // Update post ...
1
vote
0answers
2k views

How can I bulk update all posts without making changes?

I'm setting up a site which uses a custom vehicle auction theme. Using the WP All Import plugin, an XML file loads vehicle details into the theme, these are a type of post. In order for vehicles to ...
0
votes
1answer
107 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
1k views

What action hook updates post meta?

Is there an straight-forward example anywhere of using wp_update_post() to edit post_meta on the front end? I have not been able to find any good learning resources. What I want to do is display post ...
0
votes
3answers
524 views

What does wp_update_post() do that the $wpdb class does not?

I recently had to make direct changes to my wp_posts table from a WordPress plugin. I first tried to do this with wp_update_post(), thinking that would would do it. Apparently, wp_update_post() is ...
0
votes
2answers
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
2answers
436 views

bulk post_content update

I need to replace all post_content in a particular tag/category to the desired one i have. is their a plugin to accomplish it or is their a query to finish this. Iam sick of doing this manually, is ...