WordPress Database Clean Up Tutorial
If your WordPress site is several months old or older and you’ve been creating content on a regularly you’ll likely benefit from the following tutorial. But PLEASE, Pretty PLEASE make sure that you have a database backup before following along. I’ll post a link below on a tutorial on how to backup a database.
The site that you’re on right now has been edited and transformed several times over the past few years, I’ve deleted countless old posts, edit posts several times, changed video players so I’d then need to go back into posts and change the embed code and much more.
The reason I’m telling you this is because the more you do to your wordpress site the bigger your database is going to be, the database keeps data that’s no longer needed.
Have You Ever Cleaned Up Post Revisions?
If you didn’t already know, every time you save a draft post, go back and edit published posts or even every X amount of time while creating a post, a post revision is created. This is basically a backup copy of the post you’re creating.
It’s a great feature, but if you’re like me and take a long time to type, or publish posts and then go back and edit several times, each post is going to have a huge amount of post revisions.
If you don’t clean up old post revisions, they start to build up along with the database size. Something else is comments, if you leave comments unapproved and just ignore them as 98% are spam type comments, they start to build up and increase the database file size.
So much that we do within wordpress increase the size of the database, and in return it can affect the load time of the site/post/page.
The Easy Method To Clean Up The Database
In the following video I’m going to show you a plugin called “WP Clean Up”, it’s very straightforward and easy to use as you’ll see. BUT this plugin deletes data from the database, so once it’s been deleted, it’s GONE.
Please make sure you have a complete backup of your database before using the WP Clean Up plugin, if you don’t have a database backup, you can check out this tutorial: Database Backup that I created first.
Youtube video link: How To Optimize a WordPress Database
Do You Need Help?
Should you run into any problems or need some help, please let me know and I’ll gladly help you out, especially if you’re a Wealthy Affiliate free or premium member.
What Should I Delete & Clean Up?
That’s a good question and something I’ll try help answer the best I can, but please remember that every one’s site is different. For example, I never go back to old revisions unless it’s within the period I’m actually creating the post/page, so I’m perfectly OK with deleting old revisions every few months for this site.
Final reminder – make sure you have a database backup before using this plugin to clean up and optimize the database.
- Revision: As I mentioned above, I personally – Delete
- Draft: If you save draft post then – Do Not Delete
- Auto Draft: To be on the safe side – Do Not Delete
- Moderated Comments: Unapproved comments – Check them first
- Spam Comments: Check these via your comments area if not sure – Delete
- Trash Comments: Already in trash – Delete
- Orphan Postmeta: All rows in wp_postmeta that don’t have a corresponding row in the wp_posts will be deleted. – Delete
- Orphan Commentmeta: Similar as above but related to commentmeta – Delete
- Orphan Relationships: Not 100% sure, I delete with no problem
- Dashboard Transient Feed: Cached feeds from the dashboard feeds – Delete
How To Optimize A WordPress Database with WP Clean Up
If you’re wondering what exactly happens when you optimize a database like me try explain. Let’s say you’ve just deleted several post, the content from the posts are deleted, but the table still contain blank used space (if that make sense).
So when you optimize the database it removes the blank spaces.