Webpage loading speed is a critical element for your website’s success. Besides being one of the known ranking factors, it’s also as an important usability metric. Nobody (people or bots) want to spend their time waiting for your website to load, especially when there are a dozens of other websites on the same topic that load faster.
The good news is that there are ways to speed up your website by following some best practices for managing your WordPress installation and taking into account a few guidelines during the publication process.
Why page speed is important?
Back in April 2010, Google officially announced that page speed is part of the Google ranking algorithm. They main reasons that forced them to add speed as a ranking factor were:
- It makes users happy and they spend more time on a website.
- It reduces operating costs.
- It increases sales (and transactions in general).
Fast forward to 2016, speed is now more important than ever. Statistics show that slow loading websites are losing customers since a large majority of users are not willing to wait for more than 3 seconds for a website to load.
In addition, in a recent study analyzing 1 million Google search results, the correlation between Google rankings and page speed was strong with the majority of websites occupying the first places on Google SERPS to load in less than 2 seconds.
Note: Speed is a page ranking factor meaning that it affects each page individually and not the website as a whole.
7 Ways to improve the loading speed of your WordPress website
WordPress is a great content management system and out of the box loads fast with out any issues. The problems start to appear when you add custom themes, plugins and different types of heavy content (images, videos) that negatively impact the loading of the website.
What do you do in such cases, how can you improve the loading speed of your website?
There are a number of things you can do but let’s review them one by one.
#1 – Deactivate unnecessary plugins
It’s a common practice to install WordPress plugins for testing purposes and then forget them. As a first step, review all your active plugins and deactivate the ones that are not used. Even if you don’t actively use a plugin, the plugin code/CSS is still loaded and this affects your website speed.
As a second step, go through the plugins you actually use and see if there are ways to do what the plugin does but without having the plugin. For example, you may use a plugin to add adsense ads to your web pages but with a few lines of code into your functions.php, you can have the same outcome without having to load the extra coding and logic added by a plugin.
Simple changes like that, although they may seem not important, they can help you gain a few seconds in loading time.
#2 – Optimize your images and videos
In many cases a webpage is slow because of the images. Good quality images and other visual elements are important for SEO and usability so removing them completely is not an option.
What you should do instead is try to minimize their file size without sacrificing their quality. As explained before, there are 6 ways to do this:
- Use an image optimizer before uploading the images to WordPress (I use image optim).
- Use a plugin to perform certain file size optimizations when images are already loaded to WordPress (I use ewww image optimizer).
- Upgrade WordPress to the latest version so that you can take advantage of responsive images.
- Use a content delivery network (CDN) to deliver the images to users over their network. This decreases the size of the page and the number of requests needed to complete a page load from your server.
- Add the following code:
to your .htaccess so that browsers will store the images in their cache for a certain period of time. This will speed up the loading of your website for users that view more than one page of your website and who visit your website regularly.
- Lazy load of images. This is a technique where the browsers load the images in a page or post when they are needed i.e. as users scroll down the page and not all images at once (this is the default behavior). There are a number of plugins that can help you do this without having to do any changes to your website.
As far as Videos are concerned, the best way to minimize their impact on loading speed is to uploaded them to a streaming service i.e. YouTube and then embed them on your website.
By doing it this way, your server is not responsible for streaming the video content but this comes directly from the provider. Also, make sure that you don’t auto play the videos as this is not a good user experience but have the videos started by the user on request.
Note: On some websites you sometimes see Video as a background. While this looks nice if it slows down your web site, it does not worth it.
#3 – Use a caching plugin
Caching is a mechanism that helps a lot with page speed and is a must for all WordPress websites.
In simple words, when you use caching, WordPress creates static HTML versions of your webpages and shows that to users instead of generating the pages from the beginning every time there is a request for a page.
This makes the process faster, less server resources are required and the user gets a better experience. Of course the whole system is clever enough to understand when there is a change to a page or when not to cache a page so the overall website experience is the same.
There are a number of caching plugins available, you can test them and find the one that works better for you. I use wp super cache, which is free, easy to configure and owned by Automattic (that’s the company behind WordPress).
Configuring the plugin is not difficult but you do have to read their installation guide to make sure that you don’t miss any important configuration.
#4 – Optimize your WordPress DB
WordPress behind the scenes is based on a MySQL Database. While you don’t need to know any other technical details, what you need to understand is that by adding/deleting content/posts to your website, the database gets bigger and at some point is good to do some maintenance work.
Fortunately, you can do so without having to login to the DB and run SQL queries. Wp-optimize is the most popular plugin that can help you optimize your WordPress Database by:
Deleting unnecessary post revisions (every time you click ‘Save Draft’, a version of the post or page is kept to the DB).
Deleting spam comments.
Re-indexing the database tables (don’t worry if you don’t know what this is).
If you don’t want to have this plugin active all the time, you can activate it once per month and run it or you can keep it on and use the schedule feature to run DB maintenance automatically every couple of weeks.
#5 – Avoid loading resources directly from other websites in your website header.
Besides having Google analytics code in your website’s header, try not to add any other external resources (unless really necessary) that have to be loaded when the page is loaded.
I see a lot of people adding scripts or code from other websites and this can slow your website down without realizing it. When the page is loaded your WordPress installation will try to load the resources defined in the header and if the other server fails to respond quickly this will delay the loading of your web site.
If necessary to have other scripts or code, add them to the footer or use asynchronous scripts that don’t impact the initial loading of a page.
After a couple of weeks, I noticed that my website became slow and after investigation I realized that the cause was the loading of the resources from the scripts website. The solution was to remove the loading of the script from the header and to a custom implementation using resources loaded from my server.
#6 – Consider changing hosts
If after you do the above changes, you still notice that your website is slow then it’s time to consider changing hosts.
Where you host your WordPress website can play a big role in speed and to your SEO. Serious bloggers or businesses should use VPS to host their websites and not shared hosting.
The main difference between the two is that shared hosting is cheaper but your website is hosted on the same server with dozens of other websites sharing the same resources. When you rent your own Virtual Private Server (VPS), your website is hosted on its own IP, on a virtual server that has dedicated resources.
This means that your installation is more secure and any potential problems or flaws in other websites do not negatively impact your website’s performance. It’s more expensive that shared hosting but it certainly worth’s it.
Hint: You can read my previous post on how do hosting providers affect SEO.
#7 – Use Google Page Speed Module
If you are on a VPS, then an alternative to using a caching plugin is to use Google Page Speed Module. This is a price of software developed by Google that is installed on your webserver and takes care of caching and optimizing your HTML and CSS without having to do any changes to your website.
I have tested this on a number of websites and it works well but the downside of this is that you need the help of your hosting provider to install the module of your web server and some technical knowledge to configure it correctly.
If you want to play with it and test it, you can read all about it here.
How to measure you page speed?
While so far we have talked about ways to improve your loading speed, the only way to know if your changes are working positively or not is to use a couple of page speed tools and take different measurements.
Measuring your website before and after the changes, will help you identify exactly where the problem is.
The first tool to use is page speed insights, by Google.
Enter your website URL and click ANALYZE.
What you see is the speed performance of your website for both Mobile and Desktop as well as a number of suggestions from Google on how to improve your performance.
Your goal is to get the highest possible score and achieve a green check mark. While working with page speed insights, read in detail the recommendations by clicking the “Show how to fix” option below each comment.
A second tool that is useful is pingdom website speed test. What is nice about this tool is that you can take speed measurements and see how your website is performing in different geographical locations. This is useful when you are located in a different country than your target audience.
In addition, pingdom gives you a thorough analysis of all the requests performed until a page is fully loaded and this is useful when trying to find out what is causing the delay.
Page speed is important and something that you need to check on a regular basis. It’s not a one-time task. As your website grows both in content and traffic, you need to periodically check your website’s load speed (especially for your popular pages), and take actions where necessary to improve it.
Making use of a caching plugin (or Google Page Speed Module) will help you solve a number of speed problems and if you also take care of your image sizes then your webpage loading speed will improve dramatically.
Keeping WordPress and all plugins up to date is also important since new versions are more likely to include speed improvements.
Finally, use the two tools mentioned above to take measurements from different geographical locations to ensure that the majority of your users can access your website fast with no unnecessary delays.