In the third part of my series about the regular maintenance tasks you need to perform on your WordPress site,  I’m going to talk about optimising your WordPress site (in the UK we optimise never optimize 🙂 ).
See the base of this posts for the other articles in this series.
What Is Optimisation?
Optimisation is my fancy way of saying spring cleaning your WordPress site. Â During an optimisation process you would clean up your database, Â any unwanted files, any unwanted comments and remove any unused plugins or themes.
Here are the things I recommend you do every 3-6 months on your WordPress site.
Clear Plugin Tables
If you are anything like me, you are constantly testing new plugins on your site. Â This is fine, but there is a downside to this, and that is the orphaned database tables that are left over.
Very few plugins are written to remove their data once they are deactivated. Â As a result lots of tables can be left over creating an overhead on your database.
I recommend you run a plugin garbage collection every few months using this plugin:
http://wordpress.org/plugins/plugins-garbage-collector/
WARNING: this is a complex process please read this post before doing this https://neilmatthews.com/year-blog-tidy-up-version.
Optimise Your Database Tables
Your WordPress database is also creating overhead for itself during it’s day to day work. Â It add entries to it’s index and creates a working file which can grow in size if not truncated regularly.
If this file grows too big it can have an adverse affect on your site performance. Â To fix this, I recommend the following plugin, but please remember as with all major database changes,take a backup first and know how to recover that backup.
http://wordpress.org/plugins/wp-optimize/
Install and configure this plugin as you would any other plugin and scroll down to the wp-optimize menu.
Select optimize tables (there spelling not mine) and click on process
I’m going to use this plugin for a number of other optimisation jobs so they can all be batched into one session.
Remove Revision History
WordPress create a revision copy of all posts, pages and custom post types every time you go into edit them. Â This is great if you want to roll back to a previous version, but not great for database performance. Â It is holding multiple version of each bit of content on your site.
It’s a good idea to purge post history every few months as it clogs up your database.
Turning back to our good friend wp-optimize, Â click on remove post revisions and process the queue.
If you have lots of unwanted draft posts you can also do that at the same time with the check box to remove unwanted drafts.
Remove Unused Plugins
During an optimisation it’s a good idea to review your plugin list and remove any unwanted plugins.
First review your list for plugin functionality that you do not use any more and disable those plugins.
Next up, Â review your plugins for redundant functionality e.g. I see lots of people with SEOÂ plugins install that provide google sitemaps, but they will also have a sitemap plugin installed. Â Same goes for security plugins, choose one and go with that, it’s not a good idea to install multiple security plugins thinking it will add additional layers of security, often it just causes conflicts.
Disabling plugins frees up memory for the rest of your site to use.
Then delete the plugins to free up disk space, and of course don’t forget to run plugin garbage collection to remove those database tables.
If you have plugins that are not used very often but you still need them, it’s good practise to disable them and only activate them as required, an example is the maintenance mode plugin, which you only need when your site is being worked on.
Remove Unused Theme Files
You can only really use one theme at a time, I recommend you delete any unused theme files to free up disk space.
Word of warning, if you have a child theme, you will also need to have a copy of the parent theme installed, don’t delete that. Â A good example of this is Genesis, you will need the genesis files and your child theme files to make this work.
Unused Files Can Harbour Malware
Just a note on security (which we will be touching on in the next post). If you have a series of unused themes or plugins installed they could be harbouring out of date code which is vulnerable or infected with malware.  Deleting old code is also good security practise.
An example this would be the timthumb script, which  allows people to upload malware very easily unless patched.  I come across many many sites with old abandoned themes which include this script and can let hackers in.  Just because a theme is not active does not mean a theme script cannot be run.
Clear Spam Comments
Many site owners have anti-spam plugins in place, but often they do not clear out the spam.
Just because the comment is spammed, does not mean it has been removed from the database, I can think of four sites that have crashed or have had major performance issues due to huge spam comment backlogs.
A quick spam comment optimise with wp-optimize can save you a few hundred dollars in maintenance charges from a company like mine..
If you have a huge number of spam comments (tens of thousands) sometimes clearing out spam takes a long time and scripts can timeout  with a 500 error, if this happens to you, don’t worry simply re-run the scripts and clear them out in batches.  Akismet commonly does this for large backlogs.
Check your anti spam plugin, often they will clear out spam automatically for you.
Wrap Up
Optimisation like this doesn’t need to be done as often as backups and standard updates but I do recommend you visit your site every 2-3 months with this in mind.
Anyone who has signed up for our regular WordPress maintenance service gets all of these things done as a matter of course.
If you would like us to look after your backups, updates to WordPress, theme and plugins, regular optimisation, security and uptime monitoring, crash recovery then please check out our WordPress maintenance page, we are offering new clients a 15 day free trial.
 See the other posts In This Series
- Regular WordPress Maintenance – Backups
- Regular WordPress Maintenance – Updates
- Regular WordPress Maintenance – Optimisation
- Regular WordPress Maintenance – Security Monitoring (coming soon)
- Regular WordPress Maintenance – Uptime Monitoring (coming soon)