The WordPress revisions system keeps a copy of any draft or published article or page. This option is enabled by default, and users who are unaware of its existence can easily find themselves in a situation with dozens of copies of each of their posts.
The revisions system allows you to compare the content of the published post with any available revision or compare two random revisions if the option Compare any two revisions is selected:
In this article, we'll show you how to manage WordPress revisions.
To see a list of all available revisions, click the Screen Options link in the upper right corner:
and check the box next to Revisions in the Boxes section:
Under the editor Revisions section will appear alonside all features you've activated from Screen Options > Boxes:
When you are writing or editing your posts and pages, the changes you make are automatically saved every 2 minutes. In the lower right corner of the editor, you'll see a notification of when the entry was last saved to the database.
Autosaves are automatically enabled for all posts and pages. There is only one autosave for each post/page. Each new autosave overwrites the previous autosave in the database.
You can manage revisions by adding one line of code in
define( 'WP_POST_REVISIONS', false );
define( 'WP_POST_REVISIONS', 0 );
Enable revisions (only if they were previously disabled):
define( 'WP_POST_REVISIONS', true );
define( 'WP_POST_REVISIONS', -1 );
To enable saving certain number of revisions:
define( 'WP_POST_REVISIONS', 2 );
WordPress will store two revisions (+1 autosave) per post. Old revisions are automatically deleted.
Disabling revisions will deprive you of any opportunity to restore previous content. Saving all revisions will significantly increase the size of the database file. As with most things, the middle road is the safest - in our case it is to keep two revisions.
Click on revision link in the revision box under the editor or click Browse link after Revisions label in the Publish box:
Clicking Previous button will activate Restore This Revision button:
Click to restore the old revision:
If you've posted with WordPress for a while, a significant number of revisions may have been collected in the database. The best option is to use a plugin to delete all available revisions and add the code to
One plugin that does a great job is WP-Optimize:
Install and Activate the plugin. Click the WP-Optimize link in the menu:
These are the default settings, you can leave only Clean all post revisions checked and run only this option by clicking on Run optimization button:
All saved revisions are deleted, but due to the available code in
Define ('WP_POST_REVISIONS', 2);
WordPress will continue to record two revisions for each published post or page.
Be careful when using the WP-Optimize plug-in for red-marked operations - always create a database backup to eliminate the possibility of database chrash and site downtime.