Strange issue saving custom field data for a WooCommerce order
Strange issue saving custom field data for a WooCommerce order
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 …
The problem was down to my use of rel=”attachment” in the anchor, with this removed the editor allows the link to remain pointing to the file url and not the attachment.
The admin_notices hook fires only once per page load, and isn’t fired when a post is quick-edited. You would have to do it browser-side with javascript – that is, listen for when someone edits and saves a post (which is done via AJAX) and use javascript to display a message. A quick glance at the …
Think about what you’re doing here. You’re hooking into the time which WordPress is saving a post. You need to use get_post_meta() to check if the saving post has that required meta key. If you get nothing back, or get_post_meta() returns false, then you need to add your post meta for this saving post using …