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