How7o
  • Home
  • Tools
  • Prank Screens
  • Contact
  • Blog
Reading: How to Disable Revisions and Autosave in WordPress
Share
Subscribe Now
How7oHow7o
Font ResizerAa
  • Marketing
  • OS
  • Features
  • Guide
  • Complaint
  • Advertise
Search
  • Home
  • Tools
  • Prank Screens
  • Contact
  • Blog
Follow US
Copyright © 2014-2023 Ruby Theme Ltd. All Rights Reserved.
How7o > Blog > Web Development > How to Disable Revisions and Autosave in WordPress
Web Development

How to Disable Revisions and Autosave in WordPress

how7o
By how7o
Last updated: May 10, 2026
8 Min Read
WordPress disable revision and autosave — wp-config constants and wp_print_scripts dequeue
SHARE

To wordpress disable revision and autosave, add two define() lines to wp-config.php: one sets WP_POST_REVISIONS to false (or a small integer if you want a cap instead of off), the other pushes AUTOSAVE_INTERVAL to a very large number. For the classic editor you can also dequeue the autosave script from functions.php. This guide covers both, the trade-offs to think about before disabling either, and how to clean up existing revision rows.

Contents
  • TL;DR
  • Option 1 — wp-config.php constants
  • Option 2 — Dequeue the classic-editor autosave script
  • Per-post-type control (the cleaner middle ground)
  • Clean up existing revision rows
  • Trade-offs worth thinking about
  • Frequently asked questions
  • Related guides
  • References

Last verified: 2026-04-23 on WordPress 6.5 and PHP 8.3. Originally published 2023-12-18, rewritten and updated 2026-04-23.

TL;DR

// wp-config.php — add above the "That's all, stop editing!" line
define( 'WP_POST_REVISIONS', false );
define( 'AUTOSAVE_INTERVAL', 86400 );

Option 1 — wp-config.php constants

define( 'WP_POST_REVISIONS', false );
define( 'AUTOSAVE_INTERVAL', 86400 );

WP_POST_REVISIONS accepts three kinds of value:

  • false — revisions fully off. No revision row is written for any post.
  • An integer like 5 — keep at most the last 5 revisions per post. The older ones are pruned automatically on each save.
  • true (default) — unlimited revisions. Fine for small sites; a silent disk hog on long-running blogs with many edits.

AUTOSAVE_INTERVAL is in seconds, default 60. Setting it to 86400 (one day) effectively turns autosave off for any normal editing session because the next autosave wouldn’t fire until 24 hours had passed. The constant is respected by both the classic and block editor.

Option 2 — Dequeue the classic-editor autosave script

add_action( 'wp_print_scripts', function () {
    wp_deregister_script( 'autosave' );
} );

Add to functions.php. This unregisters the classic-editor autosave script so it never enqueues. The caveat is that Gutenberg (the block editor) doesn’t rely on that script — it has its own autosave mechanism — so the dequeue pattern only affects classic-editor screens. For block-editor sites, rely on the wp-config.php constants in Option 1.

Autosave and revisions are separate features in WordPress. Dequeuing the autosave script affects autosave only; the WP_POST_REVISIONS constant still governs revisions independently.

wordpress disable revision and autosave — wp-config constants for both editors, dequeue script for classic only

Per-post-type control (the cleaner middle ground)

add_filter( 'wp_revisions_to_keep', function ( $num, $post ) {
    // No revisions on products, keep default (e.g. 5) on everything else
    if ( $post->post_type === 'product' ) {
        return 0;
    }
    return $num;
}, 10, 2 );

Site-wide WP_POST_REVISIONS is a blunt instrument. The wp_revisions_to_keep filter lets you return a per-post cap — 0 to disable, any integer to cap, or the passed-in default to leave it alone. Common pattern: keep revisions on posts and pages, turn them off on high-volume imported content (products, listings) where each save would write an extra row.

Clean up existing revision rows

Disabling revisions going forward doesn’t remove the backlog. For a database already bloated with old revisions:

# WP-CLI (safest — handles meta cleanup properly)
wp post delete --force $( wp post list --post_type=revision --format=ids )

# Or raw SQL — back up first
# DELETE FROM wp_posts WHERE post_type = 'revision';
# DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT ID FROM wp_posts);

The WP-CLI form is the one to reach for — it also removes orphaned postmeta rows for the deleted revisions. The raw-SQL variant works but leaves dangling meta unless you run the second DELETE manually, and makes a mess if the schema ever diverges. Always take a database backup before either.

Trade-offs worth thinking about

  • Revisions — disabling them removes the safety net for editorial mistakes. On a multi-author site, keep a small cap (3–5) instead of false.
  • Autosave — disabling it removes the “browser crashed mid-edit, content recovered” behavior. If your editors write long-form content, keep the default 60-second interval on.
  • Disk pressure — the main reason people reach for this is a bloated wp_posts table on a shared host. Cleaning up the existing backlog is often more impactful than disabling future saves.

Frequently asked questions

Is it a good idea to wordpress disable revision?

Disabling revisions removes the safety net for editorial mistakes — no “restore to yesterday’s version” option. For a small personal blog with a single author that’s probably fine. For a multi-author publication or a client site, keep revisions on and cap the number with define('WP_POST_REVISIONS', 5) so you get the safety net without unbounded database growth. Set to false only when you’ve weighed the tradeoff.

What does AUTOSAVE_INTERVAL actually do?

It’s the interval in seconds between background autosave attempts. Default is 60. Setting it very high (86400, a full day) effectively disables autosave in any normal editing session — the browser would have to stay open for 24 hours before the next fire. The cleaner “off” is dequeuing the autosave script, which the second pattern in this post does.

Why do I still see revisions after setting WP_POST_REVISIONS to false?

The false setting only affects revisions created going forward. Existing revision rows stay in wp_posts with post_type = 'revision'. To clean up the backlog: WP-CLI wp post delete --force $(wp post list --post_type=revision --format=ids), or a one-off SQL DELETE FROM wp_posts WHERE post_type = 'revision';. Always back up first.

Can I disable revisions only on specific post types?

Yes — filter wp_revisions_to_keep with a two-argument signature: add_filter('wp_revisions_to_keep', fn ($num, $post) => $post->post_type === 'product' ? 0 : $num, 10, 2). Returns 0 for the types you want to skip and the default number for everything else. Cleaner than a site-wide WP_POST_REVISIONS constant when you want different behavior per post type.

Does the dequeue approach break the Gutenberg editor?

It disables the classic-editor autosave JavaScript, which the block editor doesn’t use for its main autosave (Gutenberg has its own internal autosave mechanism for block state). So the dequeue does nothing useful on block-editor screens. If you’re on Gutenberg and want to disable autosave there, the right path is the WP_POST_REVISIONS + AUTOSAVE_INTERVAL pair in wp-config.php, which both editors respect.

Related guides

  • How to Apply pre_get_posts on Custom Post Types in WordPress — another hook-driven WordPress customization.
  • How to Retrieve the Last Inserted Row ID in WordPress — $wpdb patterns for direct DB work.
  • How to Order Posts by Meta Value in WordPress — the pre_get_posts cousin of the filter pattern.
  • How to Change a User Profile Picture in WordPress Without a Plugin — another theme-level customization.

References

WordPress revisions and editor options: developer.wordpress.org/advanced-administration/wordpress/revisions.

TAGGED:configurationperformancephpwordpress

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Copy Link Print
Previous Article WordPress $wpdb->insert_id — read after $wpdb->insert or $wpdb->query INSERT How to Retrieve the Last Inserted Row ID in WordPress
Next Article WordPress logged-in menu swap — register_nav_menus + wp_nav_menu with is_user_logged_in ternary How to Display Different Menus to Logged-In Users in WordPress
Leave a Comment

Leave a Reply Cancel reply

You must be logged in to post a comment.

FacebookLike
XFollow
PinterestPin
InstagramFollow

Subscribe Now

Subscribe to our newsletter to get our newest articles instantly!
Most Popular
Display PHP errors — ini_set + php.ini configuration
How to Display PHP Errors
May 10, 2026
PHP convert string to uppercase — strtoupper and mb_strtoupper
How to Convert a String to Uppercase in PHP
May 10, 2026
PHP string to float conversion with cast, regex cleanup, NumberFormatter
How to Convert a String to Float in PHP
May 10, 2026
PHP merge arrays without duplicates — union operator and array_unique
How to Combine Two Arrays Without Duplicates in PHP
May 10, 2026
PHP delete array element — unset, array_splice, array_filter, array_search
How to Delete an Element from a PHP Array
May 10, 2026

You Might Also Like

WooCommerce auto add to cart on visit — template_redirect hook and cart dedup
Web Development

How to Automatically Add a Product to Cart on Visit in WooCommerce

8 Min Read
WordPress pre_get_posts scoped to a custom post type with is_post_type_archive
Web Development

How to Apply pre_get_posts on Custom Post Types in WordPress

8 Min Read
Laravel DataTables custom column search — filterColumn callback handles the search SQL
Web Development

How to Search Custom or Composite Columns in Laravel DataTables

8 Min Read
Laravel last inserted ID — Eloquent save populates model primary key illustration
Web Development

How to Retrieve the Last Inserted ID in Laravel Eloquent

8 Min Read
How7o

We provide tips, tricks, and advice for improving websites and doing better search.

Latest News

  • SEO Audit Tool
  • Client ReferralsNew
  • Execution of SEO
  • Reporting Tool

Resouce

  • Google Search Console
  • Google Keyword Planner
  • Google OptimiseHot
  • SEO Spider

Get the Top 10 in Search!

Looking for a trustworthy service to optimize the company website?
Request a Quote
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?