The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · Bash

Delete All Post Revisions from the Database

Shared by Jainil Nagar · October 7, 2026

9 views
2 upvotes
Back to Snippets

Revisions silently bloat the database on content-heavy sites. Safe to run – revisions are regenerated automatically as you edit.

Steps to use:

  1. Run the first command to see the count
  2. Run the delete command – --force bypasses the trash (revisions can’t be trashed anyway)
  3. Run the count again to confirm it returns 0

Note: If you have thousands of revisions, the delete command may time out. In that case run it in batches: add --posts_per_page=500 to the list command and repeat.

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

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

# Verify they're gone
wp post list --post_type=revision --format=count

Tested on

WordPress 7.1

Reported by the author on October 7, 2026. WPFolks has not verified this.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

1 comment

  1. Amit Dholiya
    Amit Dholiya @amitdholiya

    This is used to clean up post revisions via WP-CLI to shrink a bloated database. Handy tip to run the count first, and use the batch option if you have thousands of revisions.

    Report