How to Delete, Disable or Limit WordPress Post Revisions

Hello guys, After a long time I’m here to write a tutorial to delete wordpress post revisions.

Post revisions increase your database size and does bad effect on your site.

Post revisions are the auto saving drafts that are automatically stored in your databases. Whenever you are writing a post on WordPress, it creates post revisions when you click on “drafts”. The more you have a habit of clicking on drafts while writing posts the more space it takes on your databases.

- Advertisement -

Don’t create burden on your databases by ignoring your post revisions. Deleting post revision also improve your wordpress blog loading time.

So either disabling or limiting your WordPress post revisions can solve the solution. Here’s what you exactly need to do to limit WordPress post revisions to limit the burden on your databases.

How to Disable Post Revision

Step 1: Go to your WordPress root directory.

Step 2: Open wp-config.php

Step 3: Add the following code

define(‘AUTOSAVE_INTERVAL’, 300 ); // seconds
define(‘WP_POST_REVISIONS’, false );

This will disable your future WordPress posts revisions and increases your auto save interval from 60 seconds to 300 seconds (that means your posts will be auto saving every 5 minutes instead of each and every minute). You can also the increase the time count if you want by replacing the number.

How to Limit WordPress Post Revisions

If you want to limit the number of post revisions then add this code

define('WP_POST_REVISIONS', 3);

Change the number 3 of your choice which you want.

How To Delete Previous Post Revisions

If you want to delete post revisions and associated data that is already in the database. So you will need access to your DB, either through command line ‘mysql’ or better with phpMyAdmin interface.

Select your database and execute this query:

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'

This will remove all revision posts and associated objects from the database.

After this I recommend you to OPTIMIZE tables (in phpMyAdmin just mark all tables and select Optimize) to compact your database.

Hope this tutorial will help you to Speed Up WordPress Load Time by disabling wordpress post revisions.

Related articles

20+ Essential WordPress Plugins for Bloggers (Updated List)

WordPress is a very popular blogging platform because of...

How to Allow Contributor to Upload Images in WordPress Without Using Plugin

Hello guys, If you created the "contributor" user role...

10 Best Magazine WordPress Themes for Your Blog & News Site

If you are looking for a fantastic theme for...

Easy Ways to Fix & Increase Maximum Execution Time in WordPress

Today, I'm working on new site and installed new...

6 Best WordPress Affiliate Link Cloaking Plugins

Affiliate marketing is the best way to make money from...
Abhay Pratap Singh
Abhay Pratap Singhhttps://www.itechcube.com
Abhay Pratap Singh is Digital Entrepreneur, Who is Making Money From the Internet since 2012. He Also Works as a Freelancer and Does Web and Mobile app Development. Apart from That, He Invests in Stock Market and Crypto Currencies. Here in iTechCube, Writes about Blogging, WordPress Guides, and Tutorials to help begginers.

LEAVE A REPLY

Please enter your comment!
Please enter your name here