Is there a way to temporarily disable revisions.... I have noticed that wp_update_post is very slow and creates revisions I don't need. The fix could be to disable revisions before issuing wp_update_post and re-enable the feature once done....

4 Answers 4


To keep posts updated, I am working with WordPress 4.4 and to enable/disable post revisions programmatically use:

remove_action( 'post_updated', 'wp_save_post_revision' );
$post_id = wp_update_post( $arg );
add_action( 'post_updated', 'wp_save_post_revision' );
  • 2
    This answer was correct at the time it was authored, but there was a bug in WordPress which has been fixed quite some time ago see trac ticket #16215. This fix rendered this answer wrong. @Riccardo posted a corrected answer by now, which should be the accepted answer as of now.
    – JHoffmann
    Commented Dec 8, 2017 at 20:36

Seems this will do the job:

remove_action('pre_post_update', 'wp_save_post_revision');// stop revisions


add_action('pre_post_update', 'wp_save_post_revision');//  enable revisions again
  • How/where are you using this? I've got a plugin file with a custom function that that calls the remove_action -- but I can't figure out what hook to attach my function to. I've tried add_action on save_post & pre_post_update and a hundred others. Nothing seems to have an effect. (The function is running, but revisions are still created.) The only place I can get the revisions to not be created is with apply_filter on wp_insert_post_data which doesn't create the revision, but also doesn't save the modified post data at all either. @JHoffmann @Riccardo
    – brandonjp
    Commented Mar 19, 2020 at 3:13

You can use the wp_revisions_to_keep filter and return 0 to effectively disable revisions, specify a maximum number of revisions to keep, or return -1 for the default of unlimited revisions. You can add the post parameter to the filter if you would like to adjust for post type.

function my_disable_revisions( $num ) { 
    return 0; 
add_filter( 'wp_revisions_to_keep', 'my_disable_revisions' );

Easiest way is to set WP_POST_REVISIONS contant to false, additional information about post revision management

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.