Skip to main content
1 of 2

At first, Data was sanitized here (line 2997). If you don't want any plugin/theme run on action save_post. User remove_all_actions to remove all functions hooked to action save_post.

function post_save_action($post_id, $post, $update)
 {
    if ($this->is_temp_saving_post($post, $post_id)) {
        return;
    }
    // Check user permissions
    if (!current_user_can('edit_post', $post_id))
        return;
    // Update post
    if (!$this->is_proper_post_type($post)) {
        return;
    }
    $processed_content = $this->process_post_data($post);
    $update_data = [
        self::POST_ID => $post_id,
        self::POST_CONTENT => $processed_content
    ];
    // Remove all functions which hooked to this action, to prevent run twice.
    remove_all_actions('save_post');
    // Update the post into the database
    wp_update_post($update_data);
    add_action('save_post', array($this, 'post_save_action'), 99);
 }