Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Disable or Limit Post Revisions in WordPress to Reduce Database Size?

Hello Folks. Welcome to WPEra. In this article, I am going to show how you can disable post Revisions and how you can limit the number of post revisions in WordPress.

What is Post Revision?

Post revision is a cool feature introduced in WordPress 2.6. This feature stores a copy of each saved draft and published update in the Database. The revision system allows us to see what changes were made in each revision i.e. what was added, what was removed and what was unchanged. By using this handy feature you can restore your post to any of the saved revisions. But most WordPress users don’t use this feature.

How Much Space Do Post Revisions Occupy?

Before publishing a post, I will do a lot of minor modifications, corrections and edits to the post. Every time when I did a modification, I will save it as a draft. Sometimes for publishing a single article, I will save the post more than 20 times. That means I am saving 20 copies of the same post in my database.

Let’s say if your blog has 100 articles each has 20 Revisions.

That means your database contains 2000 copies (100*20). So post revisions occupies tons of space.

Do Post Revisions Impacts The Site Performance?

There is popular WordPress myth that storing multiple post revision impacts the site performance. This is just a myth.

WordPress post revisions don’t impact the speed of website because its MySQL queries are written in such a smart way that, while reading from the frontend the queries doesn’t retrieve revisions.

The revisions are retrieved only on the edit page of individual posts.

So it doesn’t impact the frontend speed of your site.

The only negative impact of post revision is that they consume a lot of database space.

If you want to save the database space, then you need to either disable the revisions or lower the number of revisions stored in the database.

In this section, I will show you how to disable post revisions and how to limit the number of post revisions stored in the database.

Disabling The Post Revisions in WordPress

To disable the WordPress post revisions, you need to modify the “wp-config.php” which is located in the root directory of your site. In order to do this, you need to download this file. You can do this through FTP software like FileZilla or File Manager in your hosting cPanel.

Then find the following line in ‘wp-confing.php’.

/* That's all, stop editing! Happy blogging. */

And just above that line add the following code and save it.

/* this will disable post revisions – WPERA.NET */
define('WP_POST_REVISIONS', false );

Now upload the saved ‘wp-config.php’ to your sites root directory.

Re-enabling The Post Revisions in WordPress.

If you want to enable post revisions in future you need to replace the above code with the following code.

/* this will enable post revisions – WPERA.NET */
define('WP_POST_REVISIONS', true );

Limit The Number Of Post Revisions To Store In WordPress Database

It is a good idea to limit the number of post revision stored in the database rather than completely disabling. To limit the post revisions to a certain number of times, you need to add the following code to “wp-config.php”.

/* this will Limit post revisions – WPERA.NET */
define('WP_POST_REVISIONS', 5 );

You can change the number to how many revision you want to store in your database.

Note: These methods doesn’t delete old revisions which are already stored in your WordPress database.

The post How to Disable or Limit Post Revisions in WordPress to Reduce Database Size? appeared first on WPEra.



This post first appeared on Wpera, please read the originial post: here

Share the post

How to Disable or Limit Post Revisions in WordPress to Reduce Database Size?

×

Subscribe to Wpera

Get updates delivered right to your inbox!

Thank you for your subscription

×