Every time you save or update a post / page, WordPress will store a revision in the database (if changes were made to the content).
So, if you save or update a post 40 times, you’ll basically get 40 copies of it in your database, bloating it as hell.
In a previous post, I showed you how to completely disable WordPress revisions.
Now, in this tutorial, I’ll show you how to limit WordPress revisions, rather than disabling them.
How to limit WordPress revisions
In order to limit WordPress revisions, you’ll need to access your WordPress files and edit the
wp-config.php file, which is usually found in the root directory:
If you want to edit the file for an add-on domain, then the file should usually be found in:
Once you’ve opened the
wp-config.php file, add the below code, right before the
/* That's all, stop editing! Happy blogging. */.
define( 'WP_POST_REVISIONS', 2 );
This will limit WordPress revisions to two per post / page.
You can change that number, depending on how many revisions you want WordPress to keep.
If you still wish to use a plugin, instead of adding code, then check these revision control plugins.
How to delete existing WordPress revisions
Limiting WordPress revisions won’t delete the existing ones stored in your database.
Manually deleting them requires some SQL coding, so I won’t get into that, because it’s more risky and complex.
Therefore, I’ll recommend a revision control plugin that you could use, called Companion Revision Manager – Revision Control.
Those of you that use WP Rocket, like I do, you’ll have an option to delete WordPress revisions, along with other database cleanup features.
Create a backup first!
Be sure to create a database backup or backup the entire website before deleting your WordPress revisions.
If you don’t have a backup plugin, I recommend Updraft Plus.
That’s a wrap
Hope you found the post comprehensive enough and you’ll successfully limit your WordPress revisions!
If you have any questions or thoughts, drop a comment, contact us or message us on Facebook.
You can also purchase a ready-made WordPress website with hosting and support included!