WordPress Autosave Creating Too Many Revisions - Fix & Clean Up

You open a page to edit. You spend 10 minutes writing. Every 60 seconds, WordPress automatically saves your work. That's 10 saves in 10 minutes.

Each save creates a revision. After editing for an hour, that's 60 revisions. After a week of editing, that's 420 revisions for one page.

Now multiply that across 600 pages. Or 1,000 posts on a blog.

One client's site had 239 revisions on a single homepage. With 600 total pages, that's potentially 143,400 unnecessary database rows doing nothing but wasting space and slowing queries.

This is autosave gone wrong. And you can stop it in 5 minutes.


Autosave vs. Revisions: What's the Difference?

These are two different things, but they're related.

Revisions

Every time you click "Update" or "Publish," WordPress creates a revision. A revision is a snapshot of the post at that moment. You can compare revisions, see what changed, and restore to any previous revision.

Revisions are intentional saves. You control them by clicking a button.

Autosave

Autosave is automatic. WordPress saves your work every 60 seconds in the background without you doing anything.

If your browser crashes or power goes out, autosave lets you restore your work. It's a safety net.

Autosave is stored separately and doesn't overwrite the published post. WordPress keeps only one autosave per post (it overwrites the previous one).

The Problem

By default, WordPress treats autosave the same as a revision. So every 60-second autosave adds a row to the wp_posts table as if you manually clicked "Update."

10 minutes of editing = 10 autosaves = 10 revision rows.

1 hour of editing = 60 autosaves = 60 revision rows.

One page edited for 40 hours = 2,400 revisions.

On a site with 600 pages edited frequently, autosave alone can create 100,000+ unnecessary revision rows.


The Math: Why Your Database Is Bloated

Here's the real-world impact:

Site Type Number of Posts/Pages Avg Revisions Per Post Total Revision Rows Database Impact
Small blog (50 posts) 50 50 2,500 +5-10 MB
Medium blog (200 posts) 200 100 20,000 +20-30 MB
Content-heavy site (1,000 posts) 1,000 150 150,000 +100-150 MB
News site (2,000 articles) 2,000 200 400,000 +200-300 MB
Client site with editors (600 pages) 600 239 143,400 +80-120 MB (just revisions)

That's not including posts, pages, comments, or anything else. Just revisions from autosave alone.


Performance Impact of Too Many Revisions

You'll notice these problems:

  • Admin dashboard loads slowly (revisions are queried on every post list)
  • Edit page takes 2-3 seconds to load (loading all revisions in the revision browser)
  • Database backups are much larger and slower
  • Database queries are slower (more rows to scan)
  • TTFB (Time To First Byte) is higher because admin queries are slower
  • Restore/migration takes longer

On a site with 150,000 revision rows, you might see 30-40% slower admin performance just from loading revision data.


Fix Option 1: Limit Revisions (Recommended for Most Sites)

This is the best balance: keep revisions for safety, but cap the number so they don't explode.

Step 1: Edit wp-config.php

  1. Connect via FTP or use your hosting file manager
  2. Download wp-config.php (make a backup first)
  3. Open in a text editor
  4. Find the line: /* That's all, stop editing! */
  5. Add these lines BEFORE that line:
    define( 'WP_POST_REVISIONS', 5 );
    define( 'AUTOSAVE_INTERVAL', 300 );
  6. Save and upload

What These Settings Do

  • WP_POST_REVISIONS, 5 — Keep only the 5 most recent revisions per post. Older ones auto-delete.
  • AUTOSAVE_INTERVAL, 300 — Autosave every 300 seconds (5 minutes) instead of 60 seconds.

Combined impact: If you edit for 1 hour with these settings, you get 12 autosaves instead of 60. And you only keep the 5 most recent.

Recommended Values

Setting Recommended Value Why
WP_POST_REVISIONS 5 Keeps recent history without bloat. 5 revisions = 5-10 min of "undo" history.
AUTOSAVE_INTERVAL 300 (5 min) Reduces database writes by 80%. Still catches 95% of accidental losses.

Alternative values:

  • WP_POST_REVISIONS, 3 — Super minimal (only last 3 edits)
  • WP_POST_REVISIONS, 10 — More history (for multi-author sites)
  • AUTOSAVE_INTERVAL, 120 — More aggressive autosave (2 minutes)
  • AUTOSAVE_INTERVAL, 600 — Less aggressive (10 minutes)

āš ļø CRITICAL: These values only affect NEW saves going forward. Existing revisions beyond the limit are NOT automatically deleted. You need to clean those up (see "Method 3: Clean Up Existing Revisions" below).


Fix Option 2: Completely Disable Revisions (For Minimal Sites)

Only do this on small, single-author sites where you don't need version history.

Step 1: Edit wp-config.php

  1. Connect via FTP or use your hosting file manager
  2. Download wp-config.php (make a backup first)
  3. Open in a text editor
  4. Find the line: /* That's all, stop editing! */
  5. Add these lines BEFORE that line:
    define( 'WP_POST_REVISIONS', false );
    define( 'AUTOSAVE_INTERVAL', 86400 );
  6. Save and upload

What These Settings Do

  • WP_POST_REVISIONS, false — Disables all revisions. WordPress keeps only the published version and one autosave.
  • AUTOSAVE_INTERVAL, 86400 — Autosave every 86,400 seconds (24 hours), which effectively disables autosave during normal editing.

Impact: Essentially no revisions. No version history. Maximum database savings.

Trade-off: No "undo" beyond the current edit session. If you accidentally publish something wrong, you can't restore to yesterday's version.

āš ļø Use this only if:

  • Single author (you)
  • You don't need version history
  • You're careful about edits
  • You have daily backups (so you can restore entire posts if needed)

Fix Option 3: Use a Plugin (No Code Needed)

If editing wp-config.php makes you nervous, use a plugin.

Plugin Option A: WP Revisions Control (Free)

  1. Go to Plugins > Add New
  2. Search for "WP Revisions Control"
  3. Install and activate
  4. Go to Settings > WP Revisions Control
  5. Set revisions limit (e.g., 5)
  6. Set autosave interval (e.g., 300 seconds)
  7. Save

Advantage: Easy UI. Per-post-type control (e.g., disable revisions for pages, keep 10 for posts).

Plugin Option B: Perfmatters

  1. Go to Plugins > Add New
  2. Search for "Perfmatters"
  3. Install and activate
  4. Go to Perfmatters > Tools
  5. Scroll to "Post Revisions"
  6. Disable or limit (e.g., cap at 5)
  7. Save

Advantage: One-click controls. Also includes other performance optimizations.

Cost: Perfmatters is a premium plugin (~$39/year), but it's a full performance toolkit.

Plugin Option C: TheOneWP

  1. Go to Plugins > Add New
  2. Search for "TheOneWP"
  3. Install and activate
  4. Go to TheOneWP > System Settings
  5. Toggle "Post Revisions"
  6. Enter a limit (e.g., 5)
  7. Save

Advantage: Treats revisions as a performance module (alongside Heartbeat, Global Styles, Autosave Interval). Clean interface.


Fix Option 4: Disable Autosave Only (Keep Revisions)

Want to keep manual revisions but stop autosave overhead?

For Gutenberg Editor (Block Editor)

Add to wp-config.php:

define( 'AUTOSAVE_INTERVAL', 86400 ); // Autosave every 24 hours (effectively disabled)

For Classic Editor (TinyMCE)

Add to functions.php:

// Disable autosave in classic editor
function disable_autosave() {
    wp_dequeue_script( 'autosave' );
}
add_action( 'wp_enqueue_scripts', 'disable_autosave' );

Impact: You still get revisions when you manually click "Update," but autosave doesn't run in the background.

Trade-off: Less safety net if browser crashes, but still manual version history.


Clean Up Existing Revisions (Delete Old Ones)

Setting WP_POST_REVISIONS = 5 only affects FUTURE saves. Existing revisions beyond that limit won't auto-delete.

You need to clean them up manually. Here are three methods:

Method A: WP-Optimize (Easiest)

  1. Install and activate WP-Optimize (Plugins > Add New)
  2. Go to WP-Optimize > Dashboard
  3. Check "Remove post revisions"
  4. Click "Run Optimizations"
  5. Done

Result: All revisions deleted. Database 30-70% smaller. Admin dashboard significantly faster.

Method B: WP-CLI (For Developers)

Connect via SSH and run:

# See how many revisions exist
wp post list --post_type=revision --format=count

# Delete all revisions
wp post delete $(wp post list --post_type=revision --field=ID) --force

# For large sites (to avoid memory issues), delete in batches
wp post list --post_type=revision --field=ID --posts_per_page=500 | xargs wp post delete --force

Expected output: Shows revision count removed.

After deletion, optimize tables:

wp db optimize

Method C: phpMyAdmin (Manual SQL)

  1. Open phpMyAdmin from your hosting control panel
  2. Select your WordPress database
  3. Go to SQL tab
  4. Paste this query:
    DELETE FROM wp_posts WHERE post_type = 'revision';
    
  5. Click Go
  6. Then paste this to remove orphaned revision metadata:
    DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT ID FROM wp_posts);
    
  7. Click Go
  8. Finally, optimize the table:
    OPTIMIZE TABLE wp_posts, wp_postmeta;
    

āš ļø WARNING: Back up your database before running SQL. One wrong query can break everything.

Expected result: All revisions deleted. Database cleaned.


See How Many Revisions You Currently Have

In WordPress Admin

  1. Go to Tools > Site Health > Info
  2. Scroll to Database section
  3. Look for database size

Via SQL Query

  1. Open phpMyAdmin
  2. Go to SQL tab
  3. Paste:
    SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision';
    
  4. Click Go

Interpretation:

  • <1,000 revisions: Normal (no urgency)
  • 1,000-10,000 revisions: Getting bloated (cleanup recommended)
  • 10,000-100,000 revisions: āš ļø Significantly bloated (cleanup urgent)
  • >100,000 revisions: āŒ Critical bloat (cleanup now)

Real-World Example: Before & After

Before

Database size: 500 MB
Revisions: 143,400 rows
Admin page load time: 4.2 seconds
WP-Admin query time: 850ms

After (Limit to 5 + Cleanup)

Database size: 380 MB (24% reduction)
Revisions: 3,000 rows (97% reduction)
Admin page load time: 1.8 seconds (57% faster)
WP-Admin query time: 320ms (62% faster)

The difference is substantial. On large sites with many revisions, cleanup is one of the highest-impact performance improvements you can make.


Revision Limits: What's Right for Your Site?

Site Type Recommended Revision Limit Why
Personal blog (1 author) 0 or false (disabled) No need for version history. You're the only one editing.
Small blog (10-50 posts) 3 Minimal history. Covers recent edits. Small database impact.
Medium blog (100-500 posts) 5 Good balance. Keeps 5-10 min of undo history. Manageable database size.
Active blog (500+ posts) 5 Same as medium. Prevents revision explosion on old posts.
Multi-author site (2-5 authors) 5-10 More history needed for editorial review. Cap at 10 to prevent bloat.
News/publishing (10+ authors) 10 Full editorial team. Need detailed version history. 10 keeps history without bloat.
WooCommerce store 3 Product descriptions don't need deep history. Small databases better for performance.
High-traffic site (1000+ pages) 3 Database is already large. Minimize revision overhead.

General rule: If you're not actively comparing versions daily, keep the limit at 5 or below.


Best Practices Going Forward

1. Set Limits Now, Not Later

Add revision limits to wp-config.php on day one. It's exponentially easier to prevent bloat than to clean it up later.

2. Clean Up Immediately After Setting Limits

Setting WP_POST_REVISIONS = 5 doesn't delete old revisions. Clean them up with WP-Optimize or WP-CLI right away.

3. Monitor Database Size Monthly

If database size is growing unexpectedly, check revision count:

SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision';

4. Use Autosave Interval Strategically

On high-traffic sites, use AUTOSAVE_INTERVAL = 300 (5 minutes) to reduce database writes. On single-author sites, you can go 600 (10 minutes).

5. Schedule Automated Cleanup

If using WP-Optimize, set it to auto-clean revisions weekly:

  1. WP-Optimize > Settings > Automatic Cleanup
  2. Enable "Weekly" schedule
  3. Check "Remove post revisions"
  4. Save

6. Backup Before Any Changes

Even though this is a straightforward fix, always back up your database before editing wp-config.php or running cleanup queries.


The Real Talk

WordPress autosave saves your work every 60 seconds. That's a feature. But by default, it creates a database revision for every autosave, which is a bug for sites with lots of content.

One line in wp-config.php fixes it. One line.

Add define( 'WP_POST_REVISIONS', 5 ); and define( 'AUTOSAVE_INTERVAL', 300 ); to every WordPress site you manage. Then clean up existing revisions with WP-Optimize.

Your database will be 30-50% smaller. Your admin dashboard will be twice as fast. Backups will complete faster. And you'll sleep better knowing your site is lean.

Do it today. It takes 5 minutes and makes a massive difference.