Save current post using custom save button
I think you inject some code to display your custom button. You can try to add the save post action in your code: do_action(‘save_post’); And then add redirect code, be carefull with the Infinite loop.
I think you inject some code to display your custom button. You can try to add the save post action in your code: do_action(‘save_post’); And then add redirect code, be carefull with the Infinite loop.
So yes, the problem is not with the saving, it’s how you load the saved data back… See the documentation for get_post_meta: if you dont’ provide a meta data key, the function returns all meta data for that post – which has to be returned as an array. Try this instead: $littlereds_storedMeta = get_post_meta($post->ID, ‘catagory’, … Read more
How to get a post meta value and pass that to update_option when a post is created or updated?
The problem was permissions to Administrator and Editor of editing HTML. In multisite those permissions are gone – so I’ve installed Unfilterd MU plugin and its solved.
This can happen as you said there are some errors in code or if there is long or duplicate queries. Try to debug it with Query Monitor. Same reason if Safe button takes longer to get active.
Access NEW/UPDATED post values in save_post() callback function
You can check the request value, before save and get an hint via wp_die() add_action( ‘save_post’,’wpse46583_save’, 10, 2 ); function wpse46583_save( $post_id, $post ) { // verify this is not an auto save routine. if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE ) return; // You should check nonces and permissions here if ( ! current_user_can( ‘edit_page’, $post_id … Read more
The answer appears to be clear if you look at the source code. The action you’re hooking to occurs inside wp_insert_post, and is called just before it returns the $post_ID variable. This means that all the manipulation and data insertion has already taken place, so modifying the $_POST array will do nothing. You must look … 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
Check if ( defined( ‘DOING_CRON’ ) && DOING_CRON ), which will be true if the post save is triggered during a scheduled cron job.