Improving WordPress speed by cleaning revisions
What is a revision
Every time you save the changes on a post or a page WordPress keeps a revision of your content as a backup. This way you can easily revert any changes that may not look like you wanted them to. You can easily select an older version of your content and go back to it, just by selecting it.
But a long list of post revisions might slow your blog down and use more resources than normal, so here is how to delete, limit or disable the post revisions in WordPress.
Delete all revisions
The SQL source code bellow will delete all your post revisions and all the data associated with the post revisions. This is an SQL Query and you can run it via the PHPMyAdmin interface.
! BE SURE TO KEEP A BACKUP OF YOUR DATABASE BEFORE RUNNING IT !
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'
The code should be placed in the wp-config.php file located in the root folder of your WordPress installation. It will completely disable post revisions.
Limit the number of revisions
The code should be placed in the wp-config.php file located in the root folder of your WordPress installation. This will limit the number of revisions to 7. It won’t stop making revisions after the 7th one, it will simply delete the oldest automatically and create a new one.