The problem with WordPress Revisions
Every single time you hit the “Save Draft” button, a new copy of your post gets saved. Then you hit “Save Draft” again and ANOTHER copy gets saved. Those old copies never ever get deleted. So let’s say you have 500 posts and hit “draft” 5 times on each post before you publish it. That means you actually have over 3,000 posts saved in your database! Every post takes up more space and can slow things down.
Ask yourself: do you need revisions?
I never, ever use the revision feature. Maybe some people completely depend on it, but I don’t. I have never wanted to revert back to an earlier version of a post. It’s just not the way I write. Therefore, revisions are completely useless to me and they’re just taking up extra space!
However, if you do use revisions, it’s still worth installing WP-Optimize. Just skip the next section on disabling revisions!
Disable revisions
There is a small bit of code you can add to a WordPress file to disable post revisions. Connect to your site in an FTP client and open up the wp-config.php file. Look for the line that says:
/* That's all, stop editing! Happy blogging. */
And add this right above it:
// Disable post revisions define('WP_POST_REVISIONS', false );
Then save and re-upload this back to your server. Ta-da! Now WordPress will no longer create post revisions.
But that’s not all. All those revisions we talked about still exist in your WordPress database. Let’s get rid of those!
Install WP-Optimize to clean up your database
Install a plugin called WP-Optimize. This plugin will allow you to:
- Delete all post revisions
- Delete auto drafts
- Purge spam/unapproved comments
- Optimize your database tables
So install it and delete away! I deleted all my post revisions and I also optimized my database tables. I totally wish I took a screenshot beforehand, but I had THOUSANDS of post revisions! It was absolutely insane.
I can’t find a way to edit my config.php but I have installed that plugin and boy… I had over a thousand revisions. x)
You should at least regularly delete them if you can’t disable them completely!
I did delete them with the plugin! 🙂
Oh wow, I never knew this. So getting WP Optimize when I switch.
Thank you so much for this plugin! I just started my blog a month ago and in this short time I had almost 400 revisions!
Oh, if only this was available for wordpress.com. I don’t even think I’ll never need it, and I want to get rid of it, but there’s no way how. And that takes up space? I just want to petition WordPress to allow us to opt out. That would be less work for them, right? Hosting all that would mean money.
Anyway, thanks for pointing that out, Ashley! I’ll definitely think twice about hitting that button. Or maybe I just type up a draft with a lot of revisions, then delete the draft after I’ve copy/pasted everything. Hmmm . . .
Well WordPress.com works very, very differently.
For example, on self-hosted WordPress you have your own database. So if you delete all your revisions, you’re massively cleaning your database and that can make a huge difference. But on WordPress.com, hundreds or thousands of blogs all share the same database. So if ONE person were to delete all that one person’s revisions, it wouldn’t make a big difference since every other hundreds/thousands of people will still have all their revisions.
But that being said, it’s entirely possible that WordPress.com does some routine maintenance and cleans out old revisions or something. I have no idea though.
Whether it matters for loading time or not, I still wish there was a way to delete my old copies… it just bugs me seeing that I have 17 versions of the same post (and several of them are identical or nearly identical… auto-saves, fixing a typo, what have you…)
Thank you!!! I’ve had concerns about the inefficiency of having so many unnecessary revisions, not to mention the spam. What a big sigh of relief to find out there’s a way around it! So glad I’m following this blog… 🙂
Will the wp-config.php file need to be updated after every WordPress update? Or, will this revision be retained?
Thank you so much for the info!! I’ll be downloading WP-Optimize today 🙂
You don’t have to update it after every WP update. The wp-config.php file doesn’t get touched during updates. 🙂
Oh wow, I had 3412 revisions! I actually do use the revisions from time to time, since our internet goes out often. I won’t disable them, but I’ll definitely clean up regularly!
Definitely a good idea! 🙂
I didn’t realized it saved so many revisions!! I’m not going to mess with the code, but I did install the plugin…I had 3,522 revisions! O_O
It’s crazy how quickly they add up!
I had over 500 revisions, haha. I always wondered about that, because I have never once felt the need to revert back to a previous version of a post. This WP-optimize is definitely a lifesaver!
Thanks for this, Ashley. I didn’t know that all post revisions will be saved. I presumed that whenever there’s a new update, it will just be appended to the latest copy. It didn’t occur to me that WP will make a lot of copies. That’s why my admin panel is taking so long to load. Argh.
Okay. Just installed the plugin and I have 905 revisions. I don’t even need them >,<
Thanks for this very helpful tip, Ashley!
Fantastic post, Ashley! That’s so weird how every time you save your post as a draft a new copy is saved on WordPress. All of the plugins offered for WordPress seem so efficient and handy. Urgh all of this blogger usefulness in one website lol.
Yet another reason to get on the whole plug-in bandwagon – I hate ‘revisions’!!
Thanks Ashley, I don’t feel confident enough to add the script but I’ve installed the plugin and it’s so handy.
Wow, I am embarrassed to say how many drafts I had. Thank you Ashley, this was a great help 🙂
Awesome plug-in find! I didn’t have many revisions, but it save quite a bit of space by optimizing my databases.
I might have to install this plugin! Thanks for featuring it..I’m betting my site is slow. UGH!
Thanks Ash! Just used this and it has definitely improved the speed in my admin panel! I found that was getting super slow in the last 3-4 weeks and it’s back to normal now! Yay! My site itself was already pretty fast (I improved a lot of widgets lately) but hey it can’t hurt that either! 🙂
I see it gives an option to remove pingbacks and trackbacks. I have 300 trackbacks. Wondering if I should remove these as well ….which leads me to thinking I don’t really understand pingbacks and trackbacks. Are they good or bad? Think I read somewhere the majority of the time they’re spam.
I like them. You can see some of mine below the comments. They notify you when someone links to your blog post. Akismet will catch any spammy ones. I find that most of mine are legit, and I rarely get any spam ones.
Some people don’t care about them though, so ultimately it’s up to you.
Thanks, Ashley! I had a ton of drafts and removed them. I love that it will remove unused tags, too. xo
Just tried it–wonderful! Definitely don’t want to save junk in my database. Thanks.
Wow, this sped things up so much. What does the “Remove transient options” and the “Remove orphaned postmeta” options do? It says I have things in them, but I don’t know what they are so I don’t want to check them.
Transients are a way of storing data for a period of time. There’s no harm in removing them because transients can just be remade if they’re needed.
And postmeta probably means that you have post meta data still there for posts that no longer exist. Like when you create a post, a section is stored in your blog about the post. Then a SEPARATE section is stored with information about that post, like associated tags/categories/custom fields.
So orphaned post meta probably means that the original post no longer exists, but the extra information is still there.
I didn’t see an option for orphaned post meta, does that mean I didn’t have any or was that option removed? When looking at the table data I have a LOT of post meta in relation to the number of posts.
Either they removed that option or you don’t have any. I’m not sure. But it’s common to have a ton more post meta than posts. Think of it like this: each of my posts gets an average of 1 or 2 categories and anywhere from 3-10 tags. I have almost 2,000 tags alone, but under 1,000 posts. Categories and tags are just one small part of “post meta”.
I’ve only been on WordPress for a month and already had several hundred revisions. I’m not completely comfortable playing around with the wp-config.php file just yet, but until I am will be making this a regular on the blogging to-do list. Thanks for the tip Ashley!
Totally! The revisions can really add up. Especially if you’re smart and save your drafts often. 😉