Limit Post Revisions in WordPress with WP Revisions Limit (bonus tip)

Version 3.6 of WordPress brought us the auto-save feature. Meaning, regardless of a power failure or loss of internet connection, your post or page would automatically be saved. This is an amazing feature, but what if you want to limit post revisions.

The only down side to saving every post revision is the amount of copies that accumulate in your database. Imagine you have been running your site for several years and have 100 posts with 10 revisions per post.

That’s 10,000 copies in your database, content that really doesn’t need to be there. Retaining a certain number of post revisions is a good idea, should your server crash or power failure occur. By simply clicking the restore button, you can revert back to a previous version and continue writing.

How can I limit post revisions?

You have two options available for limiting posts, for the first option we are going to install a plugin, WP Revisions Limit. Select Plugins – Add New and type in the name of the plugin in the search bar.

Next ‘Install and Activate’, you can easily set the number of revisions, by hovering over, ‘Settings’, a drop down box will appear, scroll down until you see ‘Revisions Limit’. On the next screen set the number of revisions you wish to keep and click “Save Changes”.

limit post revisions
Set number of revisions you wish to save

Limit post revisions without the use of a plugin (bonus tip)

The second option for setting a post limit, is with a simple line of code. You will need to log into your hosting account and select your ‘Cpanel’. Next scroll down until you see ‘File Manager’ click on, a pop will appear asking you to, Select the directory that you wish to open.

limit post revisions by accessing your cpanel

Select ‘Document Root for’ and check that the domain you wish to add the code to appears in the text area. Next click, “GO”.

limit post revisions, add code to document root

On the next screen, you will see all your files relating to your WordPress site, look for wp-config.php. Select the file, and at the top of the screen, click “Edit”.

limit post revisions

Scroll through the code until you see, /* That’s all, stop editing! Happy blogging. */.

Enter the code below, above that’s all, stop editing! Happy blogging and click “Save”.

define (‘WP_POST_REVISIONS’, 3);

post revisions in your database

If you wish to change the number of revisions, simply replace the number 3, with the required number you wish to save. The next time you update a page or post, all previous saved versions will be deleted and only the number that you have allocated will be saved.

Share on Pinterest
Share with your friends










Submit

Leave a Comment