What action is called when drafts are saved?

After WP 2.3 you have for all status an hook: {$new_status}_{$post->post_type}

Alternative you can use ans if for the status on hook save_post; an example for post_type post, you can change this ‘post’ to your post_type or defaults form WP:

    public function set_status_private($id, $post) {

        if ( is_object($post) && 
             'post' === $post->post_type && 
             'publish' === $post->post_status
            ) {
            $post->post_status="private";

            wp_update_post($post);
        }
    }

I hope this helps you.

Leave a Comment