Optimizing WordPress themes

Almost all WordPress themes that are available to download for free or that you can purchase contain a number of functions that most people don’t really need. I recommend that you remove these functions to eliminate unnecessary code and to allow the page to load quicker. Most themes also contain a number of different CSS files that are best combined into one single CSS file. In this article we are going to look at some functions that most users can remove and other things that you can do to optimize WordPress theme.

Emoji support

WordPress has added Emoji support to the core of WordPress but most users do not need to be able to use Emojis. If you do not use emojis then it is best to deactivate this function. This functions add a lot of code to each page and can have a noticeable effect on the load speed of your website. This is the single most important function to remove if you do not use it. There are several different ways to remove this functions. One is to deactivate it by adding code to the functions file in your theme. An easier alternative is to install a plugin that deactivates the function for you. By using a plugin you will deactivate emojis in all themes. Not just the one you edit the functions file for.

A good plugin if you want to remove emojis support is Disable Emojis by Ryan Hellyer.

Clean up the header

The header contains a number of things that can be very useful if you use them but that many users do not need. These are functions that are designed to make it easier to use 3rd party software to post to you blog and other things related to syndication. You do not need these things unless you actually use them.

Look through your header and see if there is any code that you do not know what it does. If you find any you should enter it into google to find out what it does. If you do not need that function you should deactivate the function.

There are plugins available that allow you to clean up your header and that allow you to choose which functions to keep and which to remove.

Combine CSS

speedMany themes uses more than one CSS file. This is less than ideal. The reason this is not ideal is because it forces the visitor to connect to several different files before he can see the website instead of just one. This causes the website to load slower than it otherwise would. You should try to combine all these files into one new CSS file.

It is also very common that plugins adds their own CSS files to the website. You should include these files in your main CSS file and remove the reference to the other CSS files from the header. The easiest way to do this is to use a plugin called asset queue manager. It allows you to choose which files should be included in the header and which should not. Observe that the plugin adds itself to the main admin toolbar and can not be operated from the dashboard.

Once you have combined all the CSS files I recommend that you minimize it to reduce the file size a little more.

Remove render blocking java script

This can be the absolutely hardest part of optimizing a website and some render blocking files might need to be there for the website to work correctly. One such file is Jqeury. Trying to defer the loading of the Jquery file is usually a mistake. You will need to check which files that can be deferred and which needs to load in the header for the website to work as intended. Defer all files that you can defer whit out breaking the website.