Skip to main content
added 223 characters in body
Source Link

At first, Data was sanitized here (line 2997). If

If you don't want any plugin/theme run on action save_post. User function 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
    ];
    // Backup actions
    global $wp_filter, $merged_filters;
    $backup_wp_filter = $wp_filter;
    $backup_merged_filters = $merged_filters;
    // 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',restore array($this,actions
 'post_save_action'), 99);  $wp_filter = $backup_wp_filter;
    $merged_filters = $backup_merged_filters;
 }

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);
 }

At first, Data was sanitized here (line 2997).

If you don't want any plugin/theme run on action save_post. User function 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
    ];
    // Backup actions
    global $wp_filter, $merged_filters;
    $backup_wp_filter = $wp_filter;
    $backup_merged_filters = $merged_filters;
    // 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);
   // restore actions
    $wp_filter = $backup_wp_filter;
    $merged_filters = $backup_merged_filters;
 }
Source Link

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);
 }