The tag has no wiki summary.

learn more… | top users | synonyms

4
votes
2answers
2k 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 ...
3
votes
3answers
3k 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')) { ...
3
votes
1answer
156 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?
3
votes
1answer
1k views

Custom function to rearrange attachments when creating posts – Almost there

I'm having some trouble with a custom thing I'm doing. I've implented a custom image uploader into a metabox in a custom post type. Now I'm trying to work out a way that will let me reorder the ...
3
votes
1answer
321 views

Endless loop with wp_insert_post and wp_update_post

I have an array $unqiues which contains URL's, I loop over the array with the code below to get the URL titles, insert a new post, update the post meta. Then I change the the posts title and name to ...
3
votes
1answer
806 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 ...
2
votes
4answers
4k 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?
2
votes
1answer
987 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 ...
2
votes
1answer
3k 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'] ) ...
2
votes
1answer
1k views

Problem with wp_update_post

I'm trying to write a plugin that creates a page if a box is checked (value 1) and if the post id doesn't already exist. If the post id does already exist, then I want to update the post with whatever ...
2
votes
1answer
93 views

How do I batch create revisions of all posts?

I cleaned up an old-site from pasted tags, manually created lists, etc, and I'd like to keep the old posts as "revisions", so we can easily "compare" with the old posts and retrieve/revert the ...
1
vote
1answer
452 views

Scheduling posts to update once per day with wp_cron

I have a function that hooks into save_post that changes the value of a custom taxonomy term based on today's date. That's working fine. When I update a post, the taxonomy term is updated correctly. ...
1
vote
3answers
573 views

Change the post date from a meta box

I'm having a problem with updating the post_date in a custom function I've written. I'm trying to change the "post_date" to my custom "meta_date" value. Here is the function: function ...
1
vote
2answers
53 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 ...
1
vote
1answer
66 views

Posts are duplicating on wp_post_update

I have stucked in writing a simple function that on certain page update refresh all posts in a custom post type. Here is my code (based on this): add_action('save_post', 'bulk_refresh'); function ...
1
vote
1answer
532 views

SQL query to update post_date (one post = one single date & time)

I have 120 posts of one category ready for my wordpress blog. For the moment, posts are drafts and I don't want to schedule them manually. I want to publish them like this: 4 articles each day from ...
1
vote
1answer
289 views

how to get last revision id created after wp_update_post

wordpress always store revision after call wp_update_post. How to get the post revision ID after call wp_update_post? Thanks
1
vote
1answer
1k views

List taxonomy terms for post as checkboxes

I'm modifying the plugin Wordpress Frontend User for my custom post type(s). What I need to edit is the custom taxonomy terms. In order to do this, I need to list my terms as labels and have ...
1
vote
0answers
91 views

Update a post's info when clicking on a javascript button

I have a series of posts about various locations. I need people to verify if the location informaton is correct. The question is asked with two buttons for options. If "no" is clicked, they are taken ...
1
vote
0answers
60 views

Post author for revision not being set on update/insert

I'm trying to programmatically update a custom-type post with revisions enabled via form, and everything seems to be working fine except the post_author field for the revision is being set to 0 ...
1
vote
2answers
183 views

wp_update_post via ajax from frontend

Setting: three open Tabs in browser: Tab 1: Admin edit post Tab 2: Frontend view of that post in "editing mode" Tab 3: Frontend view in "non-editing" mode (default request) I edit the post on Tab ...
1
vote
0answers
376 views

wp_update_post not working

I have the following code in a single script to be run one time to fix post names which are empty. // WP_Query arguments $args = array ( 'post_type' => 'books', ...
1
vote
0answers
120 views

Changing random post publish time for repost

I have a lot of image posts. So, on weekends I don't work for that I want to re-post a random post. I made my own code. It schedules random post with its permalink too. $time= strtotime("+10 min") ...
1
vote
1answer
102 views

custom post scheduler for drafts

I have a lot of posts everyday to publish. Now, I am thinking to schedule all those posts which I saved them as drafts. So, I tried to make a custom post scheduler. Here is what I tried, $time = ...
1
vote
1answer
248 views

If modified on same day, show only time

I have a date on each post and comment which shows the date of placement. If I edit it, it shows me the date of the post and the modified date. That's fine, but now, I want to show only the post date ...
1
vote
1answer
331 views

What 'function' will 'update' a post?

I am using a script to import my vbulletin forum posts into wordpress as posts. One quick issue I ran into is there are numerous forum posts with the same title 'please help me'. When I go into the ...
1
vote
4answers
1k 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 ...
0
votes
1answer
285 views

Wp_update_post: Infinite loop even with remove_action solution, OOP

I have a quite complex PHP class, reponsible for creating and printing meta_boxes, generating and saving meta fields, ... Each meta_box (object of class) has its own save function, that updates meta ...
0
votes
1answer
28 views

How to disable saving/changing update date for certain admin users?

I have an admin user who is only for correcting the spelling errors and grammar stuff, however, when he corrects some post that is several hours or days old and just changes "People are gready" to ...
0
votes
2answers
1k views

post_status => publish not working

I have a front end form that let users submit a post. This is how i store the data when a post is submitted : if ( isset( $_POST['submitted'] )) { $post_information = array( ...
0
votes
1answer
249 views

Gravity forms and wp_update_post [closed]

I am using Gravity Forms to let users create posts. The user fills out a bunch of information, and a post is created. The user gets to choose which categories the post is in, but there is one more ...
0
votes
1answer
804 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
1answer
104 views

Wp_editor doesn't send the required data

The wp_editor function is working fine concerning the displaying of editor and sending of information, except that the information is never sent as it is. In a template file responsible of updating ...
0
votes
2answers
827 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
332 views

Update Custom Taxonomy Value for a post based on custom date field

Quick read: I need to update the value of a custom taxonomy based on two custom field values (dates) automatically, meaning the post updates itself with having to click "update" to change the value. ...
0
votes
1answer
61 views

wp_update_post making my post sticky

I am updating my post using below code: $post_information = array( 'ID' => $_REQUEST['ID'], 'post_content' => $_REQUEST['content'], 'post_status' => 'publish' ); ...
0
votes
1answer
671 views

Custom wp_editor doesn't update post_content

I'm working on a client's site, creating a staff profile plugin. The issue is that they previously created the profiles as regular posts. I converted all of the staff posts into a custom post types. ...
0
votes
1answer
1k 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 ...
0
votes
1answer
88 views

How to keep a record of changes to a custom field?

I have a custom post type that hold real estate listings and I need to figure out a way to keep a record of the price of the property is listed for. For example a user lists a property for sale and ...
0
votes
1answer
402 views

The work of Wordpress Function update_post

I use wp_update_post() in a Frontend Page. The first part of the function works as expected. post_content and/or post_title will be changed in wp_posts. But the function does not create a revision ...
0
votes
1answer
802 views

wp_update_post is not updating category

I am using this custom function to add a publish/unpublish button to the front end of my site for the users: if ('draft' == get_post_status ($post_id)) { $post = ...
0
votes
1answer
467 views

How to use wp_update_post with ajax on frontend

I've been working hard trying to implement a frontend post editor "sidebar" on each post when I'm logged in. You can see what is going on here with a test post: ...
0
votes
2answers
284 views

Adding action to save_post, post needs to be saved twice for function to work

I have written the following function which copies all post terms from the "tribe_events_cat" taxonomy to the "categoria" taxonomy when the post is saved. There is a bug where in order for the terms ...
0
votes
2answers
279 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 ...
0
votes
0answers
11 views

wp_update_post set value to null

Is it possible to set a field to NULL using wp_update_post? I'm trying the following: wp_update_post( array( 'ID' => $future_orphan_id, 'post_parent' ...
0
votes
0answers
41 views

Updating posts not working

Lets say I want to change a posts comment count to 50 everytime the post is viewed. I have this simple code in functions.php: function update_shares() { $my_post = array(); $my_post['ID'] = ...
0
votes
1answer
50 views

Change custom post status to draft before today

I tried this code which I made but looks like I am not doing it correctly.. The main problem is my code fetches all posts ordered by meta value date, but I need to hide the posts from the date today ...
0
votes
1answer
85 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. ...
0
votes
1answer
49 views

wp_update_post behaves differently for different user role

{ "sections": [ { "section_name": "Objective", "data": "<span style=\"font-weight: bold;\">Test</span>", "key": "ref" } ] } I am updating the above JSON ...
0
votes
0answers
64 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.. ...