Use the backbone.js client to save custom post type meta
Use the backbone.js client to save custom post type meta
Use the backbone.js client to save custom post type meta
Custom Taxonomy terms aren’t getting referenced or saved in Quick Edit or Bulk Edit, only on Single product page?
“The link you followed has expired” & “Error while saving” messages when adding new post
Strange issue saving custom field data for a WooCommerce order
Plugin with action ‘save_post’ needs to press publish twice on order to publish
You should use content_save_pre filter. And maybe try some “simple” content first. wp_insert_post_data is fired in a lot of situations 🙂 Even at deleting.
How can I remove the kses filters when saving a specific post type ? (it breaks my JSON)
Get $_POST & $_REQUEST values before adding/updating post
I didn’t test this, but it should work: function check_post_attachments($post_id, $post){ if(empty(get_posts(array(‘post_type’ => ‘attachment’, ‘post_parent’ => $post_id)))){ $post[‘post_status’] = ‘draft’; wp_update_post($post); } } add_action(‘save_post’, ‘check_post_attachments’);
You should hook your actions to the save_post hook. It fires right after the post is created and the $post_id and other $post data variables are already available. Something like this should do the trick: add_action( ‘save_post’, ‘jason_code_save_post’, 10, 2 ); function jason_code_save_post( $post_ID, $post ) { if ( ‘code’ != $post->post_type || wp_is_post_revision( $post_ID … Read more