wordpress revisions preview

WordPress revisions are very useful, because they allow you to easily undo changes.
In this post I will show you how this works and also how you can delete or limit post revisions.

What are WordPress revisions?

Whenever you save a post or page, WordPress creates a backup of it and saves it as a revision in the database. This is very handy! Because with the help of this function you can easily undo changes.

Additionally, WordPress automatically creates a save point every 60 seconds, also called autosave. This ensures that your content gets not accidentally lost.

WordPress stores both in the database and offers you a kind of backup. Because in the editor you can view and compare the saves via the revisions and restore an older save with a click.

Restoring WordPress revisions

Have you accidentally deleted an image or text? Don’t panic, you can easily undo that!

To do so, simply click on the Revisions item in the Post Settings panel on the right. Here you will also see the number of already saved post revisions.

number of post revisions

Now you get an overview of the last saved revisions.

In the upper area you can see a timeline – here you can select the desired save point via slider. If you want, you can also directly compare 2 versions with each other.

Compare Revisions

Below that, both versions are then directly compared with each other. The passages marked in red have been removed, the green areas have been added. So you can go through line by line and compare the differences.

compare two post versions

After comparing two backup copies, you can decide which revision to restore.
Once you have found the appropriate revision, click the “Restore this Revision” button. After that the editor is reloaded and the desired version of your text is restored.

Elementor Revision History

The popular page builder Elementor also offers a feature to undo changes.

Elementor Revisions & history
Undo all actions with a single click in Elementor.

To do this, click on History at the very bottom of the Elementor panel.

There you can see your last actions in the left tab, which you can undo with a single click. In the tab next to it you will find the revisions, i.e. all the saves.

Delete WordPress revisions

If you’ve been running your website for a while, you’ve probably accumulated a lot of revisions over time. Normally there is no limit for the number of stored revisions.

Unfortunately, this leads to the fact that the database becomes larger and larger and thus also affects the performance. Therefore, you should first delete a large part of the old WordPress revisions and perhaps keep only the last 5.

Important: Before deleting revisions, you should create a backup of your website.

The easiest way to clean up the revisions is by using special plugins. Some of them I have already presented in my post about cleaning up WordPress like WP Sweep or Advanced Database Cleaner.

I liked the tool so much that I bought Advanced Database Cleaner Pro (one-time payment $39,- for 2 websites). I use it regularly to clean up and optimize my database.

Advanced Database Cleaner - delete revisions
With Advanced Database Cleaner you can regularly clean up and optimize your database.

With Advanced Database Cleaner you can not only delete all WordPress revisions at once, but you can also look at them again beforehand. And of course you can set how long they should be stored in the database. With a scheduler you can automate this and other cleanup tasks. So you don’t have to worry about anything anymore.

Limit WordPress revisions

To avoid cluttering your database in the future, you should limit the number of revisions.

If you don’t want to use a plugin for this, you can modify the configuration file wp-config.php. You can find it in the directory of your WordPress installation and access it via FTP. Before you do that, you should either make a backup or at least save the file.

Afterwards you simply enter the following snippet into the file wp-config.php.

define('WP_POST_REVISIONS', 5);

This limits the number of saved backups to 5. Of course you can enter another value here, but it should not be too high.

If you want to disable the revisions, you can insert the following line:

define('WP_POST_REVISIONS', false); 

If you also want to change the automatic save intervals (autosaves) of WordPress, add the following line:

define('AUTOSAVE_INTERVAL', 300); 

Instead of every 60 seconds, your posts are now only saved every 300 seconds.

Also a complete deactivation of the autosaves is possible, but not always useful. For this you have to add a code snippet in the functions.php file of your child theme.

add_action( 'admin_init', 'disable_autosave' );
function disable_autosave() {
wp_deregister_script( 'autosave' );}

FAQ

What are WordPress revisions?

As soon as you save a post or a page, WordPress automatically creates a backup and stores it in the database. These created saves are called revisions and can be accessed and restored in the editor

What are WordPress autosaves?

When you edit a post or page, WordPress automatically creates a backup every 60 seconds.

Why are the revisions not displayed in the editor?

This is often because revisions have been disabled in the wp-config file. So you have to enable revision in this file by changing

define('WP_POST_REVISIONS', false); to
define('WP_POST_REVISIONS', true);

Why should you delete old WordPress revisions?

Even if revisions are very useful, you should limit the number in any case. Otherwise, over the years, several hundred revisions per post can accumulate, which then unnecessarily inflate the database. Therefore you should regularly delete old revisions or limit the number of revisions.