Post Revisions is one of the best feature WordPress has since version 2.6. It creates a copy of the post you’re editing periodically or on demand every time you click the Save Draft button. That means you can revert back to any previous version of a post at any time when need it especially in case of a power cut or even browser or computer crash.
But there is a catch. If you save a post or a page multiple times, then the number of revisions will increase overtime as a result your WordPress database will increase too therefore the processing time becomes slower and slower.
I have a few posts which I update in regularly basis as new information added. That means these minor or major alterations are responsible for making my WordPress database to grow.
So in order to avoid that, we have a few options such as disable post revisions in WordPress, change the auto-save interval for each post revision or manually review and delete them using a plugin.
So in this article I will show you how to disable or delete old post revisions in WordPress.
Disable Post Revisions
Open wp-config.php located in your WordPress root directory and add the following code:
define('AUTOSAVE_INTERVAL', 600 ); // seconds define('WP_POST_REVISIONS', false );
The above code will disable all future revisions to be saved and increase your autosave interval from 60 seconds to 600 seconds, so it means your post will be autosaving every 10 minutes instead of every minute.
The above code, will not delete your past revisions that are already saved in your database.To do so use the following method:
Using a Plugin
This option is to use a plugin called Better Delete Revision that allows you to delete old revision of posts and pages. It also has the option to optimize your database to reduce size and speed it up.
- Log in in your WordPress Dashboard and click Plugins\Add New.
- Type Better Delete Revision in the search box and press the Enter key. The first plugin that pops up on the search results screen is the one you want to install.
- Click the Install button and then activate the plugin once the installation is completed.
- Find the Better Delete Revision plugin in your list of installed plugins and click the Settings link.
- Click Check Revision Posts button to generate a list of all the revisions that currently exist in the WordPress database.
- Then click Yes, I would like to delete them! The plugin will now begin deleting all of the existing post revisions. Be patient because it can take a couple of minutes depending on the revisions to delete.
After the revisions have been deleted, click Optimize Your Database button. The plugin will now begin optimizing the WordPress database. Again, this could take some time if a large number of revisions were deleted.
Once the process is completed, your database should be a lot smaller, better optimized and at least a little faster than it was when it still held all of those unneeded post revisions.
Please leave your comments below with the method you used or alternative ones.