How to Disable Post Revisions in WordPress and Reduce Database Size

115

Post revisions is a great feature that WordPress has to offer but for some users it might not be the best option. For users who have limited database space, or for users creating WordPress as a CMS where they don’t need autosave, they can simply disable Post Revisions feature in WordPress by following this tutorial. By reducing the database size, you can also speed up your site.

Open wp-config.php located in your WordPress root directory and add the following code:

define('AUTOSAVE_INTERVAL', 300 ); // seconds  define('WP_POST_REVISIONS', false );

This code will disable all future revisions to be saved and it will also increase your autosave interval from 60 seconds to 300 seconds, so it means your post will be autosaving every 5 minute instead of every minute.

The above code, will not delete your past revisions that are already saved in your database. To delete all previous revisions, you will need to visit PHPMyAdmin and run the following SQL query.

DELETE FROM wp_posts WHERE post_type = "revision";

This should disable Post revisions and delete all previously saved post revisions stored in your Database.

Disclaimer: We are not suggesting that Post Revisions is a bad option. This tutorial is only for those who are in the situation where they need to reduce their database size.