If you’re a minimalist like me, you would be worried about the number of Post Revisions in your WordPress blog. Revisions are stored in your blog for genuine purpose – to let you easily find, compare, and rollback to a version. However, some users might find the sheer number of revisions stored in your database as a headache – especially if the database space is limited or the site is already struggling with slow database queries.
Additionally, keeping the blog database clean and trim makes it more manageable and portable should you need to backup or migrate to a different server.
Here’s how you can disable the number of revisions stored for a post. Additionally, I will show you how to extend the auto-save interval.
Find the wp-config.php in the root directory of your WordPress installation:
Open the file in your favorite text editor and add the two lines of code:
define('AUTOSAVE_INTERVAL', 600 ); // autosave every 600 seconds - bloghow.com
define('WP_POST_REVISIONS', false ); // disable revisions - bloghow.com
Save the file and that should disable all future revisions to your content.
Your auto-save interval will now be increased to 600 seconds, which is 10 minutes.
Having said that, you’ll still see the existing revisions that are already stored in your database. To clean them up, you can directly run this query in your database (easily via phpMyAdmin):
DELETE FROM wp_posts WHERE post_type = "revision";
You may alternatively install a plugin that can do it for you without having to manually run database queries.
Either way, this will delete all previously stored post revisions from your database. New revisions will not be stored as you’ve already made the changes in the wp-config.php file.
Got a question, ask in the comments below.
Where in the file should I add the code?
You can add the lines almost anywhere in the file. Keeping it simple, why not add them at the end of the file?