WordPress Revisions: How to Use, Optimize, Limit, & Delete Them

When you’re working on a page or post in WordPress, you’ll likely go through several versions or “revisions.” WordPress revisions are the drafts of content you create using the editor. The revisions system works in the background to ensure that you always have previous versions of your work on hand. 

In this article, we’ll outline everything you need to know about WordPress post revisions. We’ll discuss how they work, where you can find them, and how to use them.

What are WordPress revisions?

When you’re creating a page or post — or even making edits to one over time — you probably save every once in a while to make sure you don’t lose your work. Each of these saved drafts, along with any published updates, is stored as a “revision” in WordPress.

two revisions side by side in WordPress

WordPress stores multiple revisions for each page or post. However, the exact number depends on how your specific site is configured. By default, there’s no limit to the number of revisions that are saved. 

One key benefit of the revisions system is the ability to view and compare different versions of your content. You can see the current page right next to a previous version in order to review changes or decide which one you want to publish. You can also see who made each change and when it occurred, which is helpful if you have multiple users on your site.

It’s important to note that WordPress post revisions show the content using HTML code, which includes information about the blocks you use and your page or post layout. While you won’t need to edit this code, it could be confusing if you’re not familiar with it.

Where to find revisions in WordPress

You can find revisions by opening a specific post or page in the WordPress Editor. Once you land on a page, select Settings → Post and click on “_ Revisions.” The blank here will show the number of revisions you have available. 

finding revisions in WordPress

This will launch a new page that includes all available revisions for the post or page you’re working on. You can use the slider near the top of the screen to switch between content versions.

How to use and manage WordPress revisions

Let’s take a deeper dive into all aspects of the WordPress revisions system, from comparing and restoring versions to even disabling them altogether!

How to preview and compare revisions

To preview and compare revisions, you need to make sure the post or page you’re currently editing has past drafts saved. You can do this by opening the Block Editor, navigating to the Settings → Post menu, and looking for the Revisions option.

the Revisions menu for a WordPress post

If you don’t see this in the post settings menu, there are no revisions available. This may be because you haven’t saved multiple drafts, the revisions system is disabled, or you deleted the previous revisions.

If the Revisions option is available, click on it. This will launch a new page that enables you to preview existing revisions and compare them.

option to compare two revisions of a WordPress post

After selecting a revision, it will appear side by side with the current version of the page or post. Now, you can compare the differences between them. 

The previous version of the post will be in the left-hand column, with the newer version on the right. You can use the slider at the top to switch between all available versions. 

By default, WordPress displays revisions in succession. If you want to compare two versions that don’t immediately follow one another, check the box next to Compare any two revisions. This allows you to pick any two specific revisions to compare next to one another.

All new content will be highlighted in green, and any content that was removed will be highlighted in red.

two revisions side by side, with green and red highlighted areas

Again, note that the page or post content is shown as code, not as blocks like in the WordPress Editor. However, this is relatively straightforward to navigate, even if you’re not a developer, thanks to HTML comments, which explain the code that follows. Let’s look at a couple of examples from the image above.

First, you’ll see this code:

<!-- wp:paragraph -->

<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>

<!-- /wp:paragraph -->

This tells you that there’s a Paragraph block here, with the text content, “Welcome to WordPress. This is your first post. Edit or delete it, then start writing!”

Then, you’ll see this:

<!-- wp:image {"id":238,"sizeSlug":"large","linkDestination":"none"} -->

<figure class="wp-block-image size-large"><img src="http://example.com/wp-content/uploads/2022/01/ze-ferrari-careto-v5Px2pav-MM-unsplash-1024x683.jpg" alt="" class="wp-image-238"/></figure>

<!-- /wp:image -->

This code tells you the following:

If you run into anything that you’re unsure of, you can use resources like W3Schools to learn what a piece of code means.

If you want to exit the Revisions panel, simply click Go to Editor at the top left. This will take you back to the WordPress Editor for this page or post.

How to revert to a previous WordPress revision

While comparing WordPress revisions, you can select the Restore This Revision option. This will restore the revision in the right-hand column.

content changes highlighted between two revisions

It’s always best to thoroughly review the content before restoring a revision, because WordPress doesn’t ask for confirmation first. And once you restore a past version of a post or page, you may not be able to revert to the most current draft you were working on.

How to limit WordPress revisions

By default, WordPress stores an unlimited number of revisions for each page or post. However, some hosts may limit this number. For example, WordPress.com saves 25 revisions for Free, Personal, and Premium plans, and 100 revisions for Business and eCommerce plans.

If you have lots of revisions, they can clog up your database and slow down your site. So, you may want to limit the number that your site saves. You can limit WordPress revisions by manually editing the wp-config.php file. The best way to access this file is by connecting to your site via FTP using a client like FileZilla.

Once you establish an FTP connection, navigate to the WordPress root directory. This might be called public_html or your site name. Open it and look for the wp-config.php file. Right-click on it and select the option to edit the file.

Look for the following line of code. The number at the end will vary because it determines the number of revisions your site can store:

define( 'WP_POST_REVISIONS', 3 );

If you can’t find that line within the file, copy the code above and paste it at the end of the wp-config.php file. You can change the 3 to any value you’d like, depending on the number of revisions you want to store. Here are some other options:

  • Use “true (default), -1” to store every revision
  • Use “false, 0” to not save any revisions at all

If you don’t feel comfortable editing code, another option is to use a plugin. One of the most user-friendly options is WP Revisions Control.

This plugin allows you to modify the number of revisions stored for different content types. For example, you can disable revisions for pages or products while increasing the number of stored versions for posts.

How to disable WordPress revisions

Although revisions are enabled by default in WordPress, you can easily disable them by taking similar steps to the ones discussed above. To disable WordPress post revisions, you’ll need to modify the wp-config.php file.

You can find instructions on accessing the file in the previous section, where we cover how to limit WordPress revisions. Once you find the file, you’ll need to edit the WP_POST_REVISIONS code to disable them entirely. This is the new line you’ll use:

define( 'WP_POST_REVISIONS', false );

Keep in mind that simply deleting the code won’t disable WordPress revisions. Instead, it will reset the system to WordPress’s default configuration.

Alternatively, you can use a plugin to disable post revisions in WordPress. Several tools are designed for this purpose, but one of the most straightforward options is called Disable Post Revision.

The plugin adds new settings to the WordPress dashboard, allowing you to disable revisions for posts, pages, and other types of content, all without touching a single line of code.

How to enable WordPress revisions

Revisions are enabled in WordPress by default. But if you’ve disabled them manually or using a plugin, you may want to enable them down the road. The exact method of doing so depends on how you disabled them to begin with.

If you modified the wp-config.php file manually, you can edit the code and set the number of revisions to a positive value, like in this example:

define( 'WP_POST_REVISIONS', 3 );

By using that code, you tell WordPress to store up to three revisions for every post. 

If you’re using a plugin to disable WordPress revisions, you’ll need to either edit the settings or deactivate the plugin altogether. 

How to optimize revisions in the WordPress database

In most cases, “optimizing the database” refers to deleting unnecessary content like revisions, autosaves, leftover data from plugins and themes, etc. While there are a variety of other speed optimization tasks that can make more substantial improvements, deleting revisions from the database can make a small difference.

One popular plugin for optimizing revisions is Optimize Database after Deleting Revisions. With this tool, you can choose which types of revisions you want to delete from the database, then set the tool to do so immediately or on a specific schedule.

database optimization plugin listing in the WordPress repository

Unfortunately, most database optimization plugins don’t let you choose which posts or pages to exclude from the cleanup process. That means you’ll lose access to most, if not all, of your revisions afterwards.

Frequently asked questions about WordPress revisions

If you still have questions about WordPress revisions, this section will answer them. Let’s start by talking about any potential downsides of the revisions system!

Are there any downsides to WordPress revisions?

The only potential downside to WordPress revisions is that they take up storage space. Every revision translates to an entry in your WordPress database. If you have a website with hundreds of posts and pages, revisions can contribute to a lot of additional data stored.

This may not necessarily be a problem for websites with a great hosting plan, but it can be limiting for other sites. Depending on your setup, relying on real-time backups that are stored off-site might be a better option. These don’t take up space on your server, and ensure that you always have a copy of your site on hand, even if your host is compromised.

Jetpack Backup is an excellent option here. It automatically saves your site whenever you make a change — updating a page, publishing a post, adding a plugin, etc. And, restoring a previous version of your site only takes a few clicks, even if it’s completely down!

Do WooCommerce products have revisions?

WooCommerce supports the WordPress revisions system, but this feature isn’t turned on by default. To enable revisions for WooCommerce products, you’ll need to edit the functions.php file for the theme you’re currently using.

We always recommend using a child theme when editing theme files, so that your work is saved even when you update the parent theme. 

Then, you’ll simply need to add the following code to your child theme’s functions.php file:

add_filter( 'woocommerce_register_post_type_product', 'wpse_modify_product_post_type' );

function wpse_modify_product_post_type( $args ) {

     $args['supports'][] = 'revisions';

     return $args;

}

Does WordPress support revisions for custom post types?

By default, WordPress only supports revisions for posts and pages. But you can add support for custom post types by editing the functions.php file for the theme that you’re using.

Again, we recommend using a child theme if you decide to edit theme files so you don’t lose your code when you update the parent theme.

What is the optimal number of WordPress revisions?

The optimal number of revisions will vary depending on your specific site. If you run a busy blog and update your posts regularly, you may want to keep several revisions on hand just in case. However, if your site is relatively stagnant, this feature may not be as important.

Of course, it’s always recommended to have full-site backups on hand in case of a hack or other issue. This is the best way to protect your content and customer data. Learn more about how to back up a WordPress site.

Can I only restore part of a revision?

No, unfortunately the WordPress revisions system restores the entire draft of the page or post. You can’t, for example, revert a single paragraph to a previous version. 

If you only want to restore part of a revision, you can use the revisions feature to copy the code for a specific block. Then, you can paste the code into the Code Editor of the page or post you’re working on.

You can find this by clicking the three vertical dots at the top right of the WordPress Editor. From there, simply choose Code Editor and make any changes you need to.

editing a post using the WordPress Code Editor

Should I delete revisions from the database?

Deleting revisions from the database can improve the performance of your website, especially if you have a lot of pages and posts, and accompanying stored versions. However, the potential downside here is that if you delete all the revisions, you won’t have any that you can restore.

Another option is to simply limit the number of revisions that WordPress stores. Following the instructions above, you can configure WordPress to store just one or two versions of each page or post. That way, you’ll always have a revision available in case something goes wrong.

Why aren’t WordPress revisions showing in my screen options?

If revisions aren’t showing for a specific post or page, there may not be any available. Perhaps you haven’t saved any drafts of the content. Or, it’s possible that you or another member of your team disabled the revisions system for your site.

You can use the instructions in this article to see if revisions are disabled in your theme’s wp-config.php file. You may also want to check with your hosting provider’s support team to see if they disabled revisions for any reason.

What’s the difference between WordPress revisions and autosaves?

WordPress automatically saves a copy of your work in case the Editor closes due to an unexpected error. These are called autosaves, and only one is stored at a time.

Each individual WordPress revision is a saved draft of a page or post. You can save an unlimited number of these, compare different versions, and restore a previous one if needed.

Protect your work with WordPress revisions

Revisions are a helpful part of WordPress. You can save multiple drafts of your work, review previous versions, and restore them nearly instantly. The number of revisions you access will depend on your site’s configuration.

Keep in mind that you should also use backups alongside revisions if you want to save the rest of your site’s data.

Jetpack Backup offers you automated backups that are stored off-site. It creates copies of your site whenever you make a change and stores them for up to a year, depending on your plan. 

Get started today! 

This entry was posted in Security. Bookmark the permalink.

Simon Keating profile
Simon Keating

Simon has worked in marketing and product development for over 10 years, previously at HubSpot, Workday, and now Automattic (Jetpack). He has a varied education, with a degree in chemical engineering and a masters in computer science to his name. His passion is helping people and their businesses grow.

Explore the benefits of Jetpack

Learn how Jetpack can help you protect, speed up, and grow your WordPress site.

Get up to 20% off your first year.

Compare plans

Have a question?

Comments are closed for this article, but we're still here to help! Visit the support forum and we'll be happy to answer any questions.

View support forum
  • Enter your email address to follow this blog and receive news and updates from Jetpack!

    Join 111,170 other followers
  • Browse by Topic

  • %d bloggers like this: