The work of WordPress Function update_post
The supports parameter for the post type has to ask for revisions. Example: register_post_type( ‘portfolio’, array( ‘supports’ => array ( ‘revisions’ ) ) );
The supports parameter for the post type has to ask for revisions. Example: register_post_type( ‘portfolio’, array( ‘supports’ => array ( ‘revisions’ ) ) );
Your best option here is to create a second Custom Field and store an Array of all the versions that have been used together with the date of the update and the user who commited the changes, acually everything you need to know. Hook into the save_post action and compare the Value of the Custom … Read more
After some searching and working off of some pointers from toscho, and some other helpful posts to avoid an infinite loop I managed to figure out a solution. I’ll post the code below then briefly explain: // Hook into the actions here public function __construct() { add_action( ‘add_meta_boxes’, array($this, ‘meta_boxes’ )); add_action( ‘save_post’, array($this, ‘save_bio_data’ … Read more
I need to add: post_date_gmt $post_information = array( ‘ID’ => $_REQUEST[‘ID’], ‘post_content’ => $_REQUEST[‘content’], ‘post_status’ => ‘publish’, ‘post_date_gmt’ => $post->post_date_gmt ); wp_update_post($post_information);
You are passing strings as the second parameter $terms and you have a hierarchical taxonomy. Per the Codex: For hierarchical terms (such as categories), you must always pass the id rather than the term name to avoid confusion where there may be another child with the same name. If you follow the source, you will … Read more
You’ve got the right idea but you are using some of the functions and function arguments incorrectly. // get all post IDs $post_ids = get_posts( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘numberposts’ => -1, // get all posts. ‘fields’ => ‘ids’, // Only get post IDs ) ); // info: custom field ‘actor’ = … Read more
Making this an answer so that others can find it: PHP’s native function stripslashes() will translate \” back to ” (as well as removing the backslash character from other escaped characters, and changing \\ into \).
It’s nothing to do with the class itself – you are using the reserved input name post, which is conflicting with WordPress core: <input type=”checkbox” name=”post[]” value=”%s” /> Change it something unique to your theme/plugin e.g. name=”my_plugin_ids[]”
I found the reason for this problem! The server admin found that the culprit was the suhosin PHP extension. They disabled the extension and replaced it with cagefs.
There is a hook called transition_post_status which runs at every transition. You have both the old and new status available inside the hook.