There is a good chance you will need to clean up your WordPress installation if you have been using the CMS for some time. WordPress website speed optimization allows you to significantly reduce the size of your database, resulting in a substantial speed improvement and allowing for smaller backups. Below we outline the ways in which you can achieve this.
Using WordPress over long periods of time piles up a lot of data like data from no longer used plugins, trashed comments, spam comments, post revisions, etc, which begs for WordPress database cleanup. By disposing of this type of no longer needed data, you can bring down the size of your database significantly, which will speed up your WordPress website.
Don’t let the phrase “database cleanup” frighten you. The procedure is not as complicated as it sounds.
Backup everything before you begin
Ensure you have a complete backup of your WordPress website before you begin. The changes you make using a cleanup plugin are irreversible, which requires from you to stay on the safe side of things.
Use a plugin such as WP-Sweep to clean up your WordPress database and speed up your website
After installing the plugin from the WP dashboard, just go to Tools -> Sweep to start the cleaning process. The plugin runs an analysis on the content of your database and provides a report on how much clutter you can clean. The Sweep report is nicely divided into sections, providing an easy way for you to determine what you wish to dispose of. The procedure itself takes some time and depends on the size of your database but the plugin updates you on the progress.
The nice thing about relying on this particular plugin, instead of using any other plugin that does a similar job, is that WP-Sweep uses the correct WP-specific function for deleting data from the database instead of relying on MySql queries directly. For example, the plugin WP-Optimize leaves data behind. This is the reason why I use WP-Sweep for WordPress website speed optimization.
Manual WordPress database cleanup
If you don’t want to go on with installing yet another plugin on your website, you can optimize the WordPress database yourself. This is usually done via phpMyAdmin. Many companies providing webhosting services use this software to administer all kinds of database-related tasks.
phpMyAdmin allows for easy database optimization. Just check all the boxes on the left side of your tables, choose “Optimize table” from the dropdown menu and press “Go”. Once the process completes, you will see a confirmation message.
Dealing with website bloat
The next thing you may want to consider is to reduce the so-called “dead weight” of your website.
– Post revisions – While it is great to have as many post revisions as you can have with your WP website, they contribute to the size of your database significantly. The first thing you can do about it is to limit the number of revisions the CMS stores at any given time. WordPress keeps an unlimited number of revisions by default and in order to reduce their number, you can place the following line of code into your wp-config.php file:
define( ‘WP_POST_REVISIONS’, 2 );
The number “2” here represents the number of revisions WordPress allows. By replacing it with the string “false”, you can disable post revisions completely and save the most space occupied by post revisions in your database.
A word of caution – limiting the number of allowed revisions doesn’t affect the number of revisions you currently have in the database.
– Spam comments – the plague of the Internet, the spam comments, also add to the bloat of your database.
Although WordPress deletes spam automatically after 30 days have passed, if you have a lot of traffic on your website, it may significantly affect its speed. You can easily speed up your site in the meantime by going …