Introduction
By default, WordPress stores unlimited post revisions and page revisions in the database. Overtime this can cause your WordPress database to grow in size and be very large.
Table of Contents
The WordPress revisions system allows you to easily view changes that were made to a particular post or page allowing you to revert back to a past revision if needed.
Unfortunately, WordPress has not added a setting in the WordPress Dashboard to simply turn on and off or set a limit to the number of revisions to keep. Storing unlimited post revisions and unlimited page revisions can degrade the performance of your WordPress site. Here’s how to limit WordPress revisions fast with the addition of a piece of code into your wp-config.php.
WordPress Revisions
Inside of the WordPress dashboard, you can see a Revisions section in the Publish section of the WordPress dashboard. This is where you can view the number of revisions stored for a particular post.
If you click the browse link, this will take you to another page where you can view the stored revisions. Allowing you to see what has been changed from the last revision to the revision.
Code Examples
You can add the follow code to your wp-config.php. This will allow you to either limit the number of revisions stored in the database or completely disable revisions from being stored.
In this example, setting the value to 5 will store the last 5 revisions made to a given post. When a new revision is stored the oldest revision is overwritten.
// Limit WP Post and Page Revisions // define('WP_POST_REVISIONS', 5);
In this example, setting the value to false will disable the WordPress revisions system.
// Disable WP Post and Page Revisions // define('WP_POST_REVISIONS', false);
wp-config.php Placement
To add the code to your wp-config.php you will need to access your site’s files. This can be done through your hosting account’s control panel via File Manager or through FTP (File Transfer Protocol). The wp-config.php can be located in the public_html directory for your site. In this walk through we’re going to use File Manager.
Using File Manager, locate the wp-config.php in your public_html directory. When the wp-config.php has been located, right click and select Edit from the drop down menu.
A pop up will appear in your browser’s window. Click the Edit button on this pop up.
Place the code directly below define(‘WP_DEBUG’, false);. This is down at the bottom of the wp-config.php. Click the Save Changes at the top of the Editor window when you’re done making changes.
You’re all set! You’ve now set a limit to the number of revisions for your site to keep or completely disabled the revisions system.