Disable or Limit your WordPress Blog Revisions to Manage Database Bloating

Are you frequently updating posts in your WordPress site? When you make a change to a post page and save it, it adds a revision to the database. So if you are updating your posts and pages a lot and you have a lot of posts and pages in your site then you are going to have a lot of information in your database. Unnecessary information in your database is not recommended  as it causes it to be bigger and slower than it should.
Limit your WordPress Blog Revisions

Limit your WordPress Blog Revisions

If you do a lot of revisions then you need a couple more backups, maybe five or ten, in case something breaks.

Disable your post revisions

First you need to open up your wp-config.php which will be located in your blog’s root folder. This should be located in the root of your WordPress site. You need to insert the following code in the file. You can also add a line to change the default autosave interval from 60 seconds (1 minute) to 300 seconds (5 minutes). Note, when you disable the post revisions there is still one autosave per post.

//disable WP Post Revisions
define('AUTOSAVE_INTERVAL', 300); // seconds
define('WP_POST_REVISIONS', false);
This needs to be inserted above the ‘ABSPATH’ otherwise, it won’t work. ABSPATH refers to the directory in which WP is installed.
//disable WP post Revisions
define('AUTOSAVE_INTERVAL', 300); //seconds
define(WP_POST_REVISIONS', false);

define('WP_DEBUG', false);

if (!defined ('ABSPATH'))
define ('ÁBSPATH', dirname (_FILE_)) . '/');

/** Sets up WordPress vars and included files. */
require_once (ABSPATH . 'wp-settings.php');

Save your wp-config.php file and re-upload it to your server. And you are done! The revisions option next to your Publish button will no longer show.

Limit your revisions

Instead of disabling the posts, you also have the option to limit them. You can set a number of revisions. WordPress will keep that number and delete any previous ones. See the alternate code below.

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

The above code will save only three revisions. If you don’t set a limit you might end up with a lot of revisions over time.

Limit your revisions

Limit your revisions

WordPress Plugins to Manage Post Revisions

WordPress plugins are also available for limiting the number of post revisions and won’t do harm to your blog but even using a one poorly coded plugin is enough to make your blog vulnerable to security attacks. So, for small tweaks like this, you can edit the code rather than installing a standalone plugin.

When you work on a post you end up with dozens of post revisions. Revisions are great if you want to restore a post or revert to an older draft. But many users believe that having too many revisions can increase the backup size and post query times, which will affect the overall performance of the site. If you want better control over the revisions, just install and activate the WP Revisions control plugin. With this plugin, you can define the number of revisions you want to store for each post type.

Christine

Christine

Author at onlineshouter
Christine writes for people who seek for knowledge about SEO, blogging, online marketing, gadgets and web apps.
Christine

Leave a Reply

Your email address will not be published.