Is your WordPress site becoming a monster?

Is your WordPress site becoming a monster?

If you’ve been blogging for awhile your WordPress database may be turning into a big monster — Post revisions, Transient Options, Comment Meta, Orphaned Terms — stuff you don’t even know exists!

I actually like Post Revisions. I write my blog posts directly in WordPress and sometimes I realize that what I wrote previously is actually better than my current draft. When this happens I’m glad to have post revisions.

But WordPress revisions have a negative side. They created clutter in your WP database. A cluttered database will slow down your website.

Once I’ve set the post live I don’t need all the past versions. It would be nice if WordPress had a “publish and delete revisions” button. But until it does, here are the solutions I’ve found that do exist. Remember to Backup your database before trying any of these options.

** UPDATE: You can skip down to Option 2: The Easy Way to clean up your WordPress site. **

If you've been blogging for awhile your WordPress database may be turning into a monster!Click To Tweet

Option 1: The hard way:

Remove all Post Revisions

Edit wp_config.php to turn off post revisions

Open your wp_config.php file and add the following code to turn off revisions.

define('WP_POST_REVISIONS', 0);

Delete existing post revisions in your MySQL WordPress database

Be sure to backup your database first before performing any queries in phpMyAdmin. Login to your phpMyAdmin and select the appropriate database then run this query.

Note: If your table prefix is not “wp” (default), replace wp in the code below with the prefix that you defined.

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'

All revisions will be gone.

Option 2: The Easy Way

Revision Control Plugin

If you aren’t comfortable editing your wp_config.php file or diving into the MySQL database, use the Revision Control Plugin. This plugin will allow you to adjust the number of revisions and delete existing revisions that you no longer want.

WP-Sweep Plugin

I wish I had found the WP-Sweep plugin when I first wrote this post! This will do more than just clean up post revisions. This plugin will clean up all the mess….

Simply add this plugin then go to Tools → Sweep and run sweep.

No more Monster!


sources:

  • http://codex.wordpress.org/Editing_wp-config.php#Specify_the_Number_of_Post_Revisions
  • http://blog.andreineculau.com/2008/07/delete-wordpress-26-revisions/

One thought on “Is your WordPress site becoming a monster?


  1. It would be nice to be able to easily delete past revisions. A delete this revision checkbox next to the date and time of the revision would be a nice upgrade. I’m going to look into the plugin, it sounds simple and effective!

Leave a Reply

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