HomeWORDPRESS

How to Delete WordPress Post Revisions From Database?

How to Delete WordPress Post Revisions From Database?
Like Tweet Pin it Share Share Email

In this post, I will show you how you can delete WordPress post revisions from the database.

What are Post Revisions & When WP creates them?

Post revisions are basically different versions of your post which are created by WP whenever you hit “Save Draft” or “Update” button. For example, while writing a post if you hit “Save Draft” 10 times then WordPress creates 10 post revisions for the post you are currently writing. Similarly, when you press “Update”, WP create a post revision each time. At maximum, WordPress create 25 post revisions for each post or page on your blog.

If you want to see a number of post revisions for a post or a page you are working on, you can see that my clicking on “Save Draft” or “Update” or “Publish” button at the right-hand side of your post editor.

Delete WordPress post revisions

How to Delete WordPress Post Revisions & Optimize WordPress Database ?

Now, you know how to see WordPress post revisions for your post and pages in your blog. At some point in time if you feel that you want to remove post revisions from the WordPress database then there should be a way to do that right ? Deleting posting revision is something you should take very seriously. Because this ensures better site performance  by deleting items from the database which you don’t need. After deleting post revisions, you will itself feel better site load time than before.

Do you know? – How to disable post revision in your WordPress Blog?

Install WP-Optimize

how-to-delete-post-revisions-from-wordpress-post-or-pages

At First, we are going to install & activate the free WordPress plugin WP-Optimize, developed by Ruhani Rabin. This is most widely used and rated plugin which  has over 500,000+ active installs with a 4.8 out of 5-star rating.

Site Backup

Next thing before you use this plugin is to take the full site backup. These plugins generally work as expected but as a site owner, it’s it is important for you to backup everything before deleting anything from the database. I have personally used WP-optimize on my blog and I had never faced any problems with it. For backing up my blog I use “BackWPup – WordPress Backup Plugin”. It’s a FREE wordpress backup plugin with great features like automatic backups jobs, database optimization, check and repair database etc.

Pre-run Wp-Optimize settings

Once you have installed Wp-Optimize, click into WP-Optimize on your sidebar within your WordPress dashboard. The main setting page of WP-optimize will look something like this –

how-to-delete-post-revisions-from-wordpress-post-or-pages-2

In the above setting page, there are two main ones which I recommend to anyone who wants to delete wordpress post revisions from the WP database.

  1. Clean up Post revisions , &
  2. Optimize Database Tables

You can check other options also to delete spam comments, unapproved comments, all auto draft posts, and post in the trash. Once you are ready, just click on the “PROCESS” button.

how-to-delete-post-revisions-from-wordpress-post-or-pages-3

Before hitting process, I just unchecked other options other than what I stated above. After successful processing, you can see WP-optimize has deleted 67 wordpress post revisions and optimized the ‘harpreet_wrdp1’ database successfully.

That’s it. It’s done! You can see in the image below that there are no more wordpress post revisions or page revisions in the database and the process saved almost 1MB of space.

how-to-delete-post-revisions-from-wordpress-post-or-pages-4

I have seen dramatic speed increases by doing this. You can also limit the number of revisions in WordPress. Check out this post if you want WordPress to limit the number post or page revisions or you want to disable post or pages revisions altogether. Read Here.

If you have any question, feel free to comment below. Also, share this useful tip with others too.

Don’t forget to LIKE Digital Harpreet Facebook Fan Page

You can also follow me on Twitter for latest updates related to WordPress, Blogging, Social Media & Marketing.

Comments (11)

  • Great plugin suggestion!

    I suggest wp-optimize to every blogger I come across for this main reason. WordPress post revisions can take up a huge amount of resources after only a few months of blogging.

    Reply
    • Rightly said George Azide. The plugin is very easy to use and very effective. Page revisions use space in your wordpress database and soon it increases your database size which in turn cause increased load time and can hamper your site performance. So, it always good to delete the past post revision when they are no more useful. Glad you like it!

      Reply
  • Deleting revisions is useful as they take quite a bit of space in WordPress database. But you should be sure before you delete. Because sometimes we may need an older version of a post (for reference or something)

    Reply
    • Right Lalit. Before deleting post or page revisions, it is a good idea to take full site backup and make sure that you are deleting the version that you do not need in future. Personally, I like to limit post revisions instead of deleting or turning then off at my WordPress blog.

      Reply
  • Hi Harpreet,
    Ever could you please tell me how to delete blogspot Post Revisions From Database?

    Reply
  • Can you please tell me how to delete revisions manually, I mean without plugin?

    Reply
    • I think one way to delete them is to go at PHPMyAdmin and run the following SQL query.
      DELETE FROM wp_posts WHERE post_type = “revision”;

      This will delete all the existing post revisions from the database. To avoid running this manually, the other way is to turn off the WP Post revisions.

      This can be achieved by adding the following code in your wp-config.php file –
      define(‘AUTOSAVE_INTERVAL’, 120 );
      define(‘WP_POST_REVISIONS’, false );

      I hope this will help. Thanks!

      Reply
  • Hi Harpreet,

    Thanks for the information. After deleting, can I uninstalled the plugin to free space in my database as plugin too also occupy space in database and it’s not good for page speed.

    Reply

Leave a Reply

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

4 × five =

This site uses Akismet to reduce spam. Learn how your comment data is processed.