Methods To Disable Post Revisions And Optimize The Database

wp-optimizeThis time I will share my recent experience dealing with WordPress Database optimization and disabling post revisions. Every author has his/her own experience with post revision option in WordPress. It could be very useful sometimes, if you write your articles and posts in the WordPress editor, but if you prefer to write your content offline and then only import the text, post revisions are waste of space. In such case you can disable Post Revisions option in WordPress. This can be done by adding this line in your wp-config.php file, you can found in WordPress root directory:
define('WP_POST_REVISIONS', false );
Please note this code will disable post revision feature on all future WordPress posts, but you will still need to erase the previous revisions saved in the database. To do this open the phpMyAdmin and in the SQL tab type in the following query:
DELETE FROM wp_posts WHERE post_type = "revision";
Don’t forget to backup your database and change the table prefix from wp_posts to whatever is needed.
Here is the method to disable post revisions feature and clean all past posts revisions using phpMyAdmin. But there is another method, you can do it using a plugin, WP Optimize, for example, which does far more than simply disabling post revisions and purging the ones on old posts. It allows you to clean up your WordPress database and optimize it without doing manual queries.
As usual, don’t forget to backup the database before using the plugin!
Note: the plugin doesn’t disable the future post revisions. You still have to do it manually in your wp-config.php file as mentioned above.

Leave a Comment

Your email address will not be published. Required fields are marked *