Managing Post Revisions In WordPress

WordPress Post RevisionsPost revisions where included in the WordPress core after version 2.5 to enable restoration of your post content.

Post revisions are located under your WordPress editor at the bottom of the edit post, posts and pages screens.

What is a Post Revision?

A post revision is created every time you add new content or edit the existing content of your post.

Your WordPress editor will automatically save ‘auto save’ a copy of your content as a precaution in case your accidently delete content or suffer a technical problem while editing content in your posts and pages.

Post Revisions Example:

Post Revisions

You’ll find your sites page loading times will slow down once you start adding new posts on a regular basis because of post revisions.

Deleting Post Revisions

If each of your posts contains 20 post revisions and you have created 50 posts, the total number of posts in your database will be 1000 not 50.

Whenever a post is edited, a new row will be created in wp_posts table

You can easily delete post revisions which will reduce the size of your database and speed up your page loading times as a result of far less database queries needed to process the request to load the post.

3 Plugins Which Manage & Remove Post Revisions

  1. WP Optimize is a plugin to help optimize your database. It includes a feature for deleting post revisions.
  2. Another popular plugin is named Revision Control which also offers a feature to disable the saving of post revisions.
  3. Better Delete Revisions is also one of the best plugins for deleting post revisions.

Caution: Always create a database backup using a plugin or PHPMyAdmin before deleting post revisions.

Managing Post Revisions

You can easily disable or limit the amount of post revisions once you install the Revision Control plugin.

Post Revisions Settings

Choose from the drop down menu to disable post revisions on pages and/or posts.

You can also enter your own limits in the Revision Range box.

Using Code To Delete & Disable Post Revisions

To disable auto saving of post revisions, add this code to your wp-config.php file:

define(‘WP_POST_REVISIONS’, false);

To delete all post revisions using code, run a database query in phpMyAdmin:

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = ‘revision’

Personally, i have kept post revisions enabled and normally delete them about once a week. I take full backup every day so i have post revisions stored in most of my backups just in case.

How about yourself. Do you delete post revisions using a plugin or code?

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.