In our previous articles we have explained about basics of WordPress revisions. WordPress revisions is a core function which users can’t disable from admin dashboard. Since there are multiple issues related to these revisions it is a good idea to work on the solution before you face the issue on your own site.
There are three ways to handle WordPress revisions:
- Disable the feature completely
- Restrict number of revisions and autosave interval
- Delete existing revisions stored in the database
We will discuss each option in detail.
Hosting Offer: Get special $2.95 Bluehost hosting deal.
How to Disable WordPress Revisions?
You need to modify “wp-config.php” file in order to disable revisions in WordPress. You can do this through “File Manager” option in “cPanel” available with your hosting account or using FTP software like FileZilla.
Add the following code in your “wp-config.php” file to disable revisions:
Add the code just above the “Happy blogging” comment and save your changes. You can also add 0 instead of FALSE as below:
This will disable any future creation of revisions but still one autosave revision will be created per post or page. This is due to the WordPress autosave core function which will save the post every 60 seconds to create a backup to be used in case of browser crash, computer crash or lost internet connection. Learn more about WordPress autosave.
Limit WordPress Post Revisions
Revisions are generated for each content update and results in as many as versions without much use. It is also a good idea to keep the latest four or five revisions so that you can restore it during needed situation. Add the below code in your “wp-config.php” file to restrict WordPress to keep the latest four revisions of a post or page.
Change 4 to any number as you desire, all old revisions will be automatically deleted.
Delete WordPress Post Revisions from the Database
Both the above methods will be useful only to control revisions of any future post/page you create and will not have any impact on existing revisions stored in your database for the old posts. If your main objective is to reduce the database size then you need to delete all existing revisions as well. You need to edit your database using any tools like “phpMyAdmin” offered by your hosting provider. Run the following query on your database to delete all existing revisions.
DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision';
This query will remove all revisions and all related meta data from database. However, remember the followings:
- Replace “wp_” with your table prefix in case if you changed it during WordPress installation.
- Backup your database before running any query so that you can restore it in case of an issue.
You can also use plugins to deal with WordPress revisions.
Related: Comparison of WordPress revisions and autosave.
Plugins to Disable WordPress Revisions
It may be difficult for most of the beginner level users to delete the existing revisions directly in database. There are many handy plugins available to deal with WordPress revisions effectively. Since deleting revisions is nothing but optimizing database, each WordPress optimization plugins will include the option for deleting revisions. Here we discuss the the following three plugins in detail:
Related: WordPress revision issues and fixes.
WP-Optimize is a one-time plugin offers various features including deletion of existing revisions from database. Just download, install and activate the plugin. You can see currently how many post revisions are available on your database, select the required check boxes to clean up and process it to delete all revisions.
In addition to manual processing, this plugin also offers auto scheduling of revisions cleanup with minimum weekly frequency.
You also have an option to keep specific week data and delete anything before that. This will be useful to keep the recent weeks data and delete all old revisions from database.
WP-Optimize does not provide any option to restrict or disable revisions.
Better Delete Revision
Better delete revision is another plugin allows you to delete all existing revisions on database. Just install, activate the plugin and you will see two options for checking revision posts and optimizing your database under Better Delete Revision Manager.
Checking revision posts will show all the revisions stored in database with an option to delete them.
Optimizing database option will check the status of database tables and fix the problem if any.
Better Delete Revision plugin does not provide any option to restrict or disable revisions.
WP-CMS Post Control
In contrast to the previous two plugins WP-CMS Post Control is a unique plugin offers various controls over publishing your WordPress posts based on user roles under “Post Control” section. Under “Core Functions” it offers disabling both autosave and revisions for any future posts and limit the revisions to any predefined count.
WP-CMS Post Control plugin does not provide an option to delete existing revisions.
Note: These plugins are recommended after usage, based on the up-to-date maintenance and number of downloads.
Leave a Reply
Your email is safe with us.