How To Turn Off Post Revision In WordPress

Published On: 16 June 2012.By .
  • Digital Engineering

 

One of my client was managing the Worpdress Blog for last 6 years. It was hosted on shared hosting and one day we received a notice from Hosting Provider that your database is acceeding the limit of 2GB and if we wish to conitnue we need to purchase the VPS.I was shocked that how can a database can be as large as 2GB. After some trouble shooting and search I came to know that it creates version for very edit and save it new row from http://lesterchan.net/wordpress/2008/07/17/how-to-turn-off-post-revision-in-wordpress-26/Copy of this article is as follows:”One of the irritating feature in WordPress 2.6 is the post revision. I am the only author of my blog and hence this feature is useless to me.

Just in case you are wondering how post revision works, whenever a post is edited, a new row will be created in wp_posts table. Hence if your posts or pages got edited 10 times, you will have 10 new rows in wp_posts table.

In no time your wp_posts table will be filled up and the post ID will be huge.

To turn off this feature, add this following code to wp-config.php:

define(‘WP_POST_REVISIONS’, false);

You can also delete all post revisions by running this query in phpMyAdmin:

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’

Be sure to backup your database first before performing any queries in phpMyAdmin.

*UPDATE* Auto Saves does not create a revision of the post.

Related content

That’s all for this blog

Go to Top