WordPress is database driven. Because of this, your blog performance depends on clean up and optimize a WordPress database. If you have a small and organized database, your blog performs faster than those with larger and unorganized databases do.
I have written very useful tips and techniques to make your blog perform run faster. You need to clean up and optimize a WordPress database from time to time to make it run faster. If you haven’t had the chance to do some database maintenance and housekeeping on your blog, this is the time to do it.
Table of Contents
How to Disable Post Revisions
Post revision is good if you want to keep track of the changes you make to your posts. If you do not need to do this, however, like if you are the only user of your blog and you do not collaborate with others, you should turn this feature off since you will only be wasting both server and database resources.
You can disable this post revision feature of WordPress by adding this line to your wp_config.php file :
You can also set a limit on how many revisions can be made for each post. Add this line in the wp_config.php file:
no_of_revision is basically the number of revisions you want to keep in the database. It should be an integer.
How to Remove Existing Post Revisions
Note that when you do the above-mentioned steps, you only set the limit for future post revisions. Current post revisions won’t be modified and they still stay in your database. So if you want to delete those existing post revisions, you need the plugin delete-revision. You will need to do some modifications however since this plugin only removes post revision and will not remove unused entries related to it.
How to Clean up and Optimize a WordPress Database
As you keep blogging, your database gets cluttered with unnecessary info. These only take up space and serve no other purpose. You must do clean up and optimize a WordPress database. You can free the space through phpMyAdmin using a SQL optimize table query.
If you do not want to go this route in managing your database, you can instead use this WP-DBManager plugin. To start, download and install this plugin. Go to Database -> Optimize Database, choose which table to optimize, and then click Optimize. This database optimization will only take you a minute or less.
Additionally, you can set a daily/weekly/monthly optimization for your database by going to the Database -> Database option. Scroll down until you come to the Automatic Optimizing of DB. Set it to the frequency you prefer.
How to Delete Unused Images
When you upload images onto WordPress, it automatically creates copies of them and resizes them to both thumbnail and medium sizes. Those images remain unused most of the time. There are also instances wherein you uploaded an image but ended up not using them in your post. All these unused images combine and take up space in your database and server as a result.
From the WordPress dashboard, go to Media > Library. To delete a single image, click it, then choose the Delete Permanently option. A popup will appear on the screen. Clicking OK will remove the file from your Media Library.
You can also bulk delete files and images, which is a quicker way of managing unused files. From the Media Library page, click Bulk Select at the top, click on all files you’d like to delete, and choose Delete Selected.
Here are 3 WordPress plugins that useful for cleaning unused images from the Media library.
How to Check for Broken or Dead Links
It’s normal to link to other blogs, domains, or posts. You only need to make sure that the links work and are not broken or dead. Your readers will find it off-putting if they encounter links that do not exist anymore. This also negatively affects your blog’s search engine ranking. You want to avoid these situations as much as possible.
You can use Broken Link Checker plugin to scan your blog for any broken links every time you publish a new article. It will also scan older posts when you log onto your Admin page. If any broken links are found, you will get a report and you can edit them or remove them from your posts entirely.
Delete Unused Plugins
Over time, you may have installed some plugins that you do not need anymore. If you have any lying around, it’s best you uninstall them and remove them. The fewer plugins you use, the faster WordPress can generate your plugin list and the faster WordPress can load your blog.
Remove Unused Plugins Entirely
Some tables or options are usually left behind even if you already uninstalled a plugin. These leftovers will stay and take up space in your database doing and serving no purpose so you need to remove these. If you have plugins with table entries stored in your database, use the WP-DBManager to remove them. For those with created options, use the plugin Advanced Database Cleaner to locate them and remove them from your database.
Delete other WordPress Themes
This won’t affect your overall WordPress database performance, but it is a good practice for security reasons. If you have WordPress themes that you do not use anymore, remove them.
How to Delete Spam Comments
It’s quite common to get spam comments. Sometimes, you receive them right after publishing your article. Even if you use plugins to avoid them from being posted on your blog, they will still accumulate in your database. If you receive spam comments on a daily basis, just think of the space those will take up. You can delete them by going to your Comment -> Spam page. Select the spam comments and from the dropdown box options, choose Delete.
An alternative is to use the plugin WP-Optimize. This will help you remove spam and any unapproved comments you receive.
WP-Optimize also gives you other functions like changing your username, optimizing your database table and deleting post revisions. I prefer using the WP-DB Manager myself because I can schedule regular optimization tasks for my database table.
Do you know of other ways to clean up and optimize a WordPress database? If so, please feel free to leave a comment.