How to Disable Post Revision History or Version Tracking in WordPress

wordpress-post-revision-history Wordpress provide a great feature of maintaining Revisions or History of a Post. Since WordPress 2.6, whenever you create a post in WordPress, it keeps on maintaining history. This feature might be very useful in a multi-author blog where more then one user is contributing in a post, but it may simply not required when you are the only one contributing in that post. Not only does WordPress create and stores all the past revision automatically every 10 minutes or so, it causes your server MySQL database to be bloated with unwanted data. Within a few months, your ‘wp_posts’ table will be filled up, clustered, and the post ID will be gigantic. Worst case scenario when you backup your MySQL is to have a 50MB database, too big for uploading in case of server failure. So how to disable automatic revision history creation in wordpress? Simply follow these steps:

Disable WordPress Revision History

  1. Open your wp-config.php file which will be in wordpress root installation directory.
  2. Paste following line anywhere in that file.
    define(’WP_POST_REVISIONS’, false);
    Code language: Arduino (arduino)
This will simply disable Auto Revision History creation from wordpress.

Delete previous Revision Histories in WordPress

Using above technique will not delete your previous saved post revisions, to remove previous post revision permanently, run this query using the PHPMyAdmin:
DELETE FROM wp_posts WHERE post_type = “revision”;
Code language: SQL (Structured Query Language) (sql)
Now all post revisions related records should have been purged from your SQL database and all revision history should have been deleted.
Get our Articles via Email. Enter your email address.

You may also like...

3 Comments

  1. Jimish Gaimit says:

    After it you need to run [ OPTIMIZE TABLE “wp_posts” ].
    Cause deleting lots of rows at a time, increase the overhead of table.
    To see overhead of table
    1. Login to phpMyAdmin
    2. Select the affected database. Last column label with overhead’.

  2. Fab says:

    I want to warn you against your sql query which is not very clean :

    you should use :

    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’;

    if you want to delete all related datas.. and there are many of them !

    use this request with ssh because it’s a very long one..

  3. rgoo says:

    Thanks for the advice. One thing to point out however. Your example only worked once I converted the smart quotes to straight quotes.

    Cheers,

Leave a Reply

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