How to get updated data when save_post triggers?

I’m going to post this as an answer, because it worked for me: function my_awesome_func ($post_id, $post, $update) { //update the value we need early update_post_meta($post_id, ‘my_meta_key’, $_REQUEST[‘my_meta_key’]); $newValue = get_post_meta($post_id, ‘my_meta_key’); } add_action( ‘save_post_my-custom-post-type’, ‘my_awesome_func’, 10, 3 ); You could also simply use the value of $_REQUEST[‘my_meta_key’] directly if that works, but for my … Read more

save imported posts as drafts

You can hack this plugin code by changing ‘create_draft‘ option ‘no’ to ‘yes’ into plugin.php ‘get_default_import_options‘ method(Approx line no. 1013). I’m not tested this hack, try it your own risk.

Add meta field after post has been published

You can hook into post_updated action, if you want to access the post’s data after it’s been published. This hook passes the post’s ID, inundated post object, and updated post object. add_action( ‘post_updated’, ‘update_event_date’, 10, 3 ); function update_event_date( $post_id, $post_after, $post_before ){ $post_type = get_post_type( $post_id ); $event_datee = get_post_meta( $post_id, ‘_EventStartDate’, true ); … Read more