Working with Post Revisions

WordPress stores all post drafts you have saved and the updates you have published. Its revision system allows you to compare two different revisions, restore a previous version of a post, manage and delete revisions. You can also limit the number of revisions stored, and disable the revision storing option.

Comparing post revisions

  1. Click a post in your WordPress account.
  2. In the Publish section click Browse, next to Revisions.
    Button browse
  3. Click the Next / Previous buttons, or drag the slider to display two consecutive revisions.
    Revision slider
    The differences between the two revisions are highlighted with red (for deleted text) or green (for added text).

Restoring a revision

In the comparing view click Restore This Revision. The latest of the two compared revisions is restored.

Managing post revisions with plugins

You can manage your revisions with the Revision Control plugin.With this plugin you can e.g. enable, disable or limit the number of revisions that will be saved for each page or post. Revision Control also allows you to delete revisions of your choice.

Deleting post revisions

You can delete post revisions in two ways:

  • If you are more experienced and feel comfortable working directly in the database, you can use a query to delete post revisions.
    Important: Back up your data before making changes to your database.

For example, to delete the revisions before January 1st, 2014, use the command:
DELETE FROM wp_posts WHERE post_type = "revision" AND post_modified < "2014-01-01 00:00:00";

Disabling the revision storing option

You can disable the revision storing option by modifying the wp-config.php file, which is located in the root of the WordPress installation.

Important: To change the wp-config.php file, always use a text editor (plain text), such as Notepad++. Never use word processors, such as Microsoft Word, because these can cause major problems to your code.

To disable the revision storing option, open the wp-config.php file in you text editor and add to it the following string:

define('WP_POST_REVISIONS', false );

Limiting the number of revisions using wp-config.php

To limit the number of revisions stored, open the wp-config.php file in you text editor, and add to it the following string:

define('WP_POST_REVISIONS', x);

where x is the number of revisions that you want to be stored for each post.

Please rate this post :

Leave a Reply

Your email address will not be published. Required fields are marked *