Turn Off or Delete Post Revisions in WordPress

Post Revisions are problems when only one user maintaining the blog. Turn off or limited the post revisions to save MySQL Space and Easy to tackle all problems.

WordPress is very flexible and very user friendly Blog portal ever. Every one is using this CMS to make their blog. Some developers use it for website development. It is very flexible so anyone can create website with basic knowledge. If you are blogging with it, then revisions in this CMS is headache not only for you.

I will try to describe about the revision of WordPress How to disable or how to delete post revisions in WordPress. It automatically creates post revision which will increase the size of your database. If you are only one author of your website or blog then you must disable or make it limited. I will tell briefly some of analysis how to exactly handle the post revisions in WordPress.

[readlove] Change your Wp-Admin Password from CPanel

Advantages of Revisions:
The main benefit of the revision is backup of your post so you can restore and replace older version any time. Suppose you want to restore yesterday post which is saved and suddenly today you change something and something wrong happens. What will you do ? So WordPress makes revisions to help you and restore older version of any post.

Disadvantages of Revisions:
Post revisions in WordPress is self handled, by default it is set to true always. Main disadvantage of revisions is, it increase the size of your database. If you save a post 5 times then there are 4 Revisions and 1 Draft available either they are same or change. Now what happen if i have 4 Revisions?. It will create 4 rows in your table (WP_POST) , which will increase the size of your database. Suppose you have 500+ posts then your posts+revisions will occupy a lot of space and backup for your database will a problem.

For Developers: There is post revisions function called wp_post_revisions which you have to define with 1 parameter.

define('wp_post_revisions', true | false | int);
  • true (default), -1: store every revision
  • false, 0: do not store any revisions (except the one auto save per post)
  • (int) > 0: store that many revisions (+1 auto save) per post. Old revisions are automatically deleted.

Handle Post Revisions in WordPress

Disable post revisions in WordPress using WP_CONFIG file.

  1. Go to your root directory where WordPress is installed and search for a file wp_config.php.
  2. Open this file and paste this line before it saying That’s all Stop editing! Happy Blogging.
    define( 'WP_POST_REVISIONS', false );
  3. It will disable the revisions and no revisions is saved after that. you can see in screenshot which shows no revision is saving after code implementation.
    Post Revisions in WordPress

Save Limited post revisions in WordPress using WP_CONFIG file.

  1. Go to your root directory where WordPress is installed and search for a file wp_config.php .
  2. Open this file and paste this line before it saying That’s all Stop editing! Happy Blogging.
    define( 'WP_POST_REVISIONS', 3 );
  3. This method Remove old Revisions automatically and can not be roll back. Backup your Database 1st.
  4. It will limited the post revisions to 3. Don’t get confused when you publish then then post revisions will  shown and revisions section will show you 3+ counter because it shows counter goes high but you can access only 3 backup we don’t have extra in database also. Overall you have 3 backup and a Draft / Publish post. you can see in screenshot which shows 3+ revision it means only 3 available.
    Limited Revisions in WordPress

Handling Revisions Via Plugins

Plugins are available to handle the revisions. Here are three plugins which are user rated and works fine if you’re not familiar with coding then best suitable is to use plugins.

Query to Delete Post Revisions from 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'

 

Thanks to lesterchan to provide sql query Read More. for the query help but i share it you can apply. change wp_posts to your table name it’s bit risky.

Leave a Reply

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