Home ยป How to Disable Post Revisions in WordPress

How to Disable Post Revisions in WordPress

I know you want to make your website faster than every other website in the web. Why? Because an average user is going to wait for 3 seconds on your blog. Not more than that. With that said, your blog is not going to be any faster if your blog database is not supporting. Because every setting, ever blog post you have is sitting in the database that supports your WordPress blog. In order to make your blog database faster, we need to reduce the size. I am going to answer the question How to Disable Post Revisions in WordPress.

Optimal usage of database resources is going to make sure your website loads faster. And interacts properly with the user. The default settings for WordPress admin to save any post you write is 1 minute. This is by default set by WordPress. However, you can change that. It is not only going to make sure that you have lesser transactions with the database in the admin side. But it is also going to make the same resource available for another user who might visit your website at that time.

Another point is every time you are writing on the page, and WordPress saves the draft version it gets saved as a version in the DB. Given that you are an admin, you could always save it manually. And now a days with easy internet availability it is not an concern for us whether or not we will be able to save the data before it gets auto saved or not. Why use that resource when you can save it so that a user could use the same resource?

With that, now you know there are three things to be done.

  1. Delay the duration between which WordPress saves the posts that are in Drafts.
  2. Disable for WordPress to save Revisions in the database.
  3. Delete existing revisions that would be existing in your database already.

Here are some of our other articles that you might like:

How to delay the duration between which WordPress saves the posts.

Locate Wp-Config.php in your WordPress installed folder and open it and then add the below line of code.

define('AUTOSAVE_INTERVAL', 300 ); // seconds

Like I said earlier, the by default setting by WordPress is 60 seconds but you can increase it to accordingly. I suggest 5 minutes becoming the best since it fits for all kinds of edits.

How to disable WordPress to save revisions in database.

Locate Wp-Config.php in your WordPress installed folder and open it and then add the below line of code.

define('WP_POST_REVISIONS', false );

This code is going to make sure your install of WordPress is not saving revisions in to your database. Than it is updating the post every time, it auto saves or you save it manually.

How to delete existing revisions in your database

In order to delete all previous revisions by the time you saved this config changes you will have to open PhpMyAdmin. And then run this code in SQL. Make sure to change your table name accordingly if you use any kind of prefix or suffix in the table names.

DELETE FROM wp_posts WHERE post_type = "revision";

You would be surprised how much revisions will be saved in your database. By the time I ran it for my blog I found 1888 revisions that I deleted. And after I deleted them my DB and site works much faster. Considering.

Should you need any help, please feel free to let me know in the comments below and I will be able to help you whatever you need.

Leave your mark as a Comment

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