Você pode remover o retorno de chamada do gancho save_post
, atualizar o post e adicionar novamente a chamada ao gancho. O Codex dá um exemplo .
add_action('save_post', 'wpse51363_save_post');
function wpse51363_save_post($post_id) {
//Check it's not an auto save routine
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return;
//Perform permission checks! For example:
if ( !current_user_can('edit_post', $post_id) )
return;
//Check your nonce!
//If calling wp_update_post, unhook this function so it doesn't loop infinitely
remove_action('save_post', 'wpse51363_save_post');
// call wp_update_post update, which calls save_post again. E.g:
wp_update_post(array('ID' => $post_id, 'post_status' => 'private'));
// re-hook this function
add_action('save_post', 'wpse51363_save_post');
}