Type something to search...
How to use the WordPress revisions feature?

How to use the WordPress revisions feature?

To use WordPress revisions, open a post or page in the block editor, click the Revisions link in the settings sidebar, and WordPress shows you a timeline of every saved version. Drag the slider to see what changed between versions, then click Restore This Revision to roll back to an earlier version. WordPress creates revisions automatically every time you save, so the feature works without any setup.

Revisions are WordPress's built-in undo history for your content. They can save you from accidental deletions, bad edits, and "what did this page say last month?" moments. This guide explains how revisions and autosaves work, how to compare and restore versions, how to use revisions in the Site Editor, how to control the number of revisions stored, and how to clean them up safely.

What Are WordPress Revisions?

A revision is a saved snapshot of a post or page at a particular point in time. Every time you click Save draft, Update, or Publish, WordPress stores a copy of the previous content as a revision. Over time, this builds a complete history of your changes.

Revisions store:

  • The post title
  • The post content (all your blocks)
  • The excerpt
  • Who made the change and when

Revisions don't store everything. Featured images, categories, tags, and most custom fields aren't tracked by default, although WordPress 6.4 added support for revisioning registered post meta that opts in (more on that below).

Revisions vs. Autosaves

WordPress also has autosaves, which work a little differently:

  • Revisions are created when you manually save or update a post. WordPress keeps many of them.
  • Autosaves are created automatically while you edit, roughly every 60 seconds by default. WordPress keeps only one autosave per user per post, overwriting it each time.

If your browser crashes or you lose your connection, the autosave lets you recover your latest work. When you reopen the post, WordPress shows a notice saying there's an autosave that's newer than the saved version, with a link to view it.

Which Content Types Support Revisions?

  • Posts and pages support revisions by default.
  • Custom post types support revisions if they include revisions in their supports argument.
  • In block themes, templates, template parts, and global styles also have revision histories in the Site Editor.

How to View Revisions in the Block Editor

  1. Open the post or page: Go to Posts > All Posts or Pages > All Pages and click the item you want.
  2. Open the settings sidebar: Click the Settings icon in the top-right corner and select the Post (or Page) tab.
  3. Find Revisions: In the summary panel, look for Revisions with a number next to it, showing how many revisions exist. Click it.

If you don't see a Revisions link, the post probably has no revisions yet, because it hasn't been saved more than once. Revisions can also be turned off entirely in wp-config.php or by your host.

In the Classic Editor, revisions appear as Revisions: X with a Browse link in the Publish box, and optionally a Revisions meta box below the content.

How to Compare Revisions

The revisions screen has a slider at the top and a side-by-side comparison below.

  1. Move the slider: Drag the slider or click Previous and Next to move through versions.
  2. Read the differences: Removed content is highlighted in red on the left; added content is highlighted in green on the right.
  3. Check the details: Above the comparison, you'll see who made the change and when.

Compare Any Two Revisions

By default, the screen compares a revision with the one immediately before it. To compare two revisions that aren't next to each other:

  1. Tick the Compare any two revisions checkbox at the top.
  2. The slider now has two handles.
  3. Drag each handle to the versions you want to compare.

This is useful when you want to see everything that changed over several edits, such as between the originally published version and today.

Reading Block Markup in Comparisons

Because the block editor stores content as HTML with block comments, you'll see markup like <!-- wp:paragraph --> in the comparison. That's normal. Focus on the text inside the tags to spot what actually changed.

How to Restore a Previous Revision

  1. Open the revisions screen as described above.
  2. Find the version you want to go back to using the slider.
  3. Click Restore This Revision. (If you're viewing the current version, the button is disabled.)

WordPress replaces the current content with the selected revision and takes you back to the editor. Importantly, restoring doesn't delete anything. Your current version is saved as a new revision first, so you can always undo a restore.

If the post is already published, the restored content goes live immediately. For important pages, it's a good idea to review the restored version in the editor and preview it before relying on it.

Restoring an Autosave

If WordPress detects a newer autosave, you'll see a notice at the top of the editor: "There is an autosave of this post that is more recent than the version below." Click View the autosave to open it on the revisions screen, then click Restore This Autosave if you want to keep it.

Using Revisions in the Site Editor

If you use a block theme, the Site Editor also keeps revision histories for design changes.

Template and Template Part Revisions

  1. Go to Appearance > Editor and open a template or template part.
  2. Open the settings sidebar and look for Revisions under the template's details.
  3. Click it to open the familiar comparison and restore screen.

Global Styles Revisions

Since WordPress 6.3, you can also browse revisions of your global styles (colors, typography, and layout settings):

  1. Go to Appearance > Editor > Styles.
  2. Click the Revisions (clock) icon or open the styles menu and choose Revisions.
  3. Click through the list of saved style versions. The editor previews each one.
  4. Click Apply to restore the style version you want.

This is a lifesaver when a design experiment goes wrong.

Undo and Redo vs. Revisions

The Undo and Redo buttons in the editor toolbar (or Ctrl/Cmd + Z and Ctrl/Cmd + Shift + Z) work within your current editing session. They're great for quick mistakes. Once you leave the editor, that history is gone. Revisions are the long-term history that survives between sessions.

How to Limit the Number of Revisions

By default, WordPress keeps an unlimited number of revisions. On a site with long posts that are edited often, this can add up to thousands of extra rows in the database. While revisions rarely cause noticeable slowdowns on their own, limiting them keeps your database tidy.

Using wp-config.php

Add this line to wp-config.php, above the line that reads /* That's all, stop editing! Happy publishing. */:

define( 'WP_POST_REVISIONS', 10 );

The value can be:

  • A number, such as 10, to keep that many revisions per post.
  • true or -1 to keep unlimited revisions (the default).
  • false or 0 to disable revisions entirely, apart from autosaves.

Disabling revisions altogether isn't recommended. Keeping a modest number, somewhere around 5 to 20, gives you a safety net without a bloated database. Note that when you lower the limit, older revisions beyond it are removed the next time each post is saved.

Some managed hosts set their own revision limit, so check with your host if the setting doesn't seem to take effect.

Changing the Autosave Interval

To change how often autosaves happen, add this to wp-config.php (the value is in seconds):

define( 'AUTOSAVE_INTERVAL', 120 );

The default is 60 seconds. There's rarely a need to change it.

Limiting Revisions Per Post Type With Code

For finer control, use the wp_revisions_to_keep filter. This example keeps 20 revisions for pages, 5 for a custom post type, and the default for everything else. Add it to a custom plugin or your child theme's functions.php:

function sajjad_revisions_to_keep( $num, $post ) {
    if ( 'page' === $post->post_type ) {
        return 20;
    }

    if ( 'sajjad_portfolio' === $post->post_type ) {
        return 5;
    }

    return $num;
}
add_filter( 'wp_revisions_to_keep', 'sajjad_revisions_to_keep', 10, 2 );

WordPress also provides dynamic filters named wp_{$post_type}_revisions_to_keep, such as wp_page_revisions_to_keep, if you prefer one filter per post type.

Enabling Revisions for a Custom Post Type

If a custom post type doesn't show revisions, add support for them:

function sajjad_add_revisions_support() {
    add_post_type_support( 'sajjad_portfolio', 'revisions' );
}
add_action( 'init', 'sajjad_add_revisions_support', 20 );

Or include 'revisions' in the supports array when calling register_post_type().

Revisioning Custom Fields

Since WordPress 6.4, registered post meta can opt in to revisions using the revisions_enabled argument. The post type must support both revisions and custom-fields:

function sajjad_register_revisioned_meta() {
    register_post_meta(
        'post',
        'sajjad_subtitle',
        array(
            'type'              => 'string',
            'single'            => true,
            'show_in_rest'      => true,
            'revisions_enabled' => true,
            'sanitize_callback' => 'sanitize_text_field',
            'auth_callback'     => function () {
                return current_user_can( 'edit_posts' );
            },
        )
    );
}
add_action( 'init', 'sajjad_register_revisioned_meta' );

Now changes to that field are saved and restored along with the post content.

How to Clean Up Old Revisions

If your site has years of revisions, you may want to remove old ones. Always take a full backup before deleting revisions, since this can't be undone.

Using a Plugin

Several well-known plugins can remove revisions safely:

  • WP-Optimize: Cleans revisions, auto-drafts, trashed posts, and more, and can keep a set number of recent revisions per post.
  • Advanced Database Cleaner: Offers detailed control over what gets cleaned.

Most let you run cleanups manually or on a schedule.

Using WP-CLI

If you have command-line access, WP-CLI can delete revisions quickly:

# Count existing revisions
wp post list --post_type=revision --format=count

# Delete all revisions (back up first)
wp post delete $(wp post list --post_type=revision --format=ids) --force

On very large sites, the list of IDs may be too long for a single command. In that case, a plugin or a batched approach is safer.

Using SQL

As a last resort, you can delete revisions directly in the database with phpMyAdmin or a similar tool. Replace wp_ with your table prefix, and back up first:

DELETE FROM wp_posts WHERE post_type = 'revision';

This leaves orphaned rows in wp_postmeta and wp_term_relationships in some cases, which is why plugins or WP-CLI (which use WordPress's own deletion functions) are the cleaner option.

Practical Ways to Use Revisions

  • Recover deleted content: Accidentally deleted a paragraph and saved? Restore the previous revision.
  • Audit changes on team sites: See which user edited a page and when.
  • Review client edits: Compare what a client changed before approving it.
  • Undo a bad copy-paste: Pasting from another app sometimes brings messy formatting. Roll back and try again.
  • Track content updates: For evergreen posts, revisions show how an article has evolved over time.
  • Recover from a crash: Autosaves protect you when a browser tab closes unexpectedly.

Revisions are not a replacement for backups. They only cover post content, and they live in the same database as everything else. If the database is damaged or your site is hacked, revisions go with it. Keep a proper backup plan in place, as covered in our backups guide.


FAQ: WordPress Revisions

Open the post or page in the block editor, open the settings sidebar, and click Revisions in the post summary panel. It appears once a post has been saved at least twice.

No. WordPress saves the current version as a new revision before restoring the old one, so you can always switch back.

Unlimited by default. You can set a limit by adding the WP_POST_REVISIONS constant to wp-config.php, and some hosts set a limit for you.

Usually not noticeably, since revisions aren't loaded on the front end. On large sites with many revisions, limiting and cleaning them keeps the database smaller and backups faster.

No. Revisions track the title, content, and excerpt. Featured images, categories, and tags are not revisioned, though registered custom fields can opt in since WordPress 6.4.

Revisions are created when you save or update a post, and many are kept. Autosaves happen automatically while you edit, and only the latest one per user is stored.

Yes, in block themes. The Site Editor keeps revisions for templates, template parts, and global styles, which you can browse and restore.


Conclusion

WordPress revisions give you a reliable history of every post and page, with no setup required. With the Revisions link in the editor sidebar, you can compare any two versions, see who changed what, and restore earlier content in a couple of clicks, knowing that restoring is itself reversible. In block themes, the same safety net covers templates and global styles.

For most sites, the only configuration worth doing is setting a sensible limit with WP_POST_REVISIONS and occasionally cleaning up old revisions with a trusted plugin or WP-CLI after taking a backup. Treat revisions as your everyday undo history, and pair them with a proper backup solution for complete peace of mind.

Tags :
Share :

Related Posts

What are the best WordPress security plugins?

What are the best WordPress security plugins?

The best WordPress security plugins for most sites are Wordfence, Sucuri Security, Solid Security, MalCare, All-In-One Security (AIOS), Patchstack, a

Dive Deeper
What is the difference between posts and pages in WordPress?

What is the difference between posts and pages in WordPress?

The main difference between posts and pages in WordPress is that posts are timely, dated entries that appear in your blog feed, archives, and RSS fee

Dive Deeper
How much does it cost to build a WordPress website?

How much does it cost to build a WordPress website?

Building a WordPress website can cost anywhere from roughly the price of a domain and a year of budget hosting, if you do it yourself with free tools

Dive Deeper