Website loading time is very crucial in order to retain the traffic. In this guide, I will explain how to speed up a WordPress site to the maximum so you can improve your website speed.
Having a quick site is not just an option nowadays. It is essential to have a fast loading website in the modern age. You must worry about the speed of your website if you want to improve on many factors as I will explain now.
Before I do so, please check out this article about error establishing a database connection. If you ever faced this, you know how much painful it can be! If not, just bookmark it. One day , you might need it.
The importance of website speed
The speed of your website is important and it is the tasks that must be carried out every time you develop a website.
Amazon calculated that for every second of extra load, it would lose 1.6 trillion Dollars in sales in a year.
But in addition to the losses of conversions, it also may lead to a bad user experience due to the crashes and 500 internal server errors in WordPress if the site is not properly optimized.
Speed is a positioning factor and Google penalizes slow sites . So, I hope you now have an idea about the importance of a website speed.
In this guide I will teach you everything you need to know to optimize the speed of WordPress and make it ultra fast.
Why does WordPress become slow?
There might be many reasons for having a slow website but there are basically 4 reasons why WordPress site becomes slow:
- Your hosting is not adequate: when using a quality web hosting you can see the speed of all the technology you use.
- You have a bad quality WordPress Theme: if you use a theme that has many CSS or JS scripts and is poorly optimized, it will slow down your WordPress.
- You use plugins that are too heavy: having many plugins is not bad (but not recommended if you can do work without plugin), as long as these do not make an exaggerated consumption of resources.
- You have many external scripts: if the problem is not internal, it will be external because you too many external call of scripts.
With a slow WordPress website, it makes it almost impossible to work with the admin panel.
It will also consume many more server resources, no matter if you have few or many visits.
How to speed up a WordPress site
Before I start writing about how to speed up a WordPress site, I would like to focus on how to measure the WordPress or any Website speed. Let’s begin:
Make a loading speed test to your WordPress website
The first task of any optimization is to do a loading time test AKA speed test of your WordPress website.
For this speed test, I recommend you to use GTMetrix :
Go to the GTMetrix website .
Put the URL of your website and click on the analyze button .
The result will be something like the following:
I recommend that your website meet the following requirements:
- The loading time is less than 2 seconds.
- The weight of the website is less than 1 MB ( Size of the web page) .
- Have less than 100 requests .
- The Time To First Byte or TTFB is less than 200ms. This is the first data that appears in the Waterfall tab.
I do not recommend that you analyze your website with PageSpeed , or take their recommendations seriously.
Optimize your web hosting/ Choose a performance optimized web host
No matter what optimization you do on your website, if you have a bad host, nothing will improve the experience of the user. So the first thing that I would like to focus is on the web hosting.
Switch to a quality hosting
If you want to make your website ultra-fast, the first thing you need is a good web hosting.
There may be a bestial performance difference between different web hosts.
You must search for a hosting that is specific to WordPress and also have:
- SSD hard drives.
- Gzip compression.
- PHP 7
- Http2 technology.
- Own CDN.
There are many hosting companies on the Internet and I have tried many.
Soon I will update a blog on my recommended web hosting companies.
Activate Gzip compression
Gzip is a technology that compresses the files of a website making them to weigh less and take less time to load.
It should come with all the web hosting company but for some reasons, sometime it might be missing. Or it might be there, but not activated.
You can detect if your hosting has it activated with the this tool .
If you use Cpanel ,you can activate Gzip compression in the Software / Services section called Optimize website .
Activate it by choosing the Compress all content option .
If you have no knowledge about how to do it, you can contact your hosting and they will activate it.
Or if you are an advanced user, you may like to do it through the htaccess file with the following code.
# Enable Gzip compression
Upgrade WordPress to PHP 7
WordPress is a content management system programmed with PHP, that is what it needs to work properly.
To have better performance and consume less resources you need to always have the latest version. But keep in mind that as long as all the plugins and themes are compatible, you are good to go with the latest version.
If you still do not have the latest PHP version, I recommend upgrading WordPress to PHP 7 .
Once you have verified that all your plugins and themes are compatible, you can activate it.
To do it in Cpanel just go the the software section then either PHP version manager/ Multi PHP version ( the one that your host shows) .
Just check the option or select from the dropdown ( the one that your host provides to select PHP version) to PHP 7 versions.
Header compatibility issue fixation – Accept header encoding
When activating Gzip, there may be some incompatibility with some users.
To fix it, we add the following compatibility code to the htaccess.
<FilesMatch ". (Js | css | xml | gz) $"> Header append Vary: Accept-Encoding
Deactivate the Entity tags (ETags)
Let’s say that what we are going to do is deactivate a check made by browsers and slow down the loading of the web.
Then we add the following to the htaccess .
Header unset ETag
Enable Keep Alive
Don’t become dizzy seeing alive! Let’s break down the technical terms into clear English.With this settings, the connections to your website are accelerated, because those that are already open are used.
The same instruction goest, put the code into the htaccess file.
Header set Connection keep-alive
The next step is to optimize WordPress, which includes both the content optimization, and also the optimization of all the plugins and themes that we have installed.
Use a theme that is light
My first recommendation would be to use a theme that is well optimized and light weight. A theme is the first represenation of any WordPress driven website. It visually shows the content to the audiences. Some developer tends to try to make it too much appealing without keeping in mind the speed optimization and proper coding techniques. To speed up a WordPress site, you need to have a theme with less requests to external resources and less scripts and plugins to operate. We recommend Rooten theme. We call it the ultimate speedy theme available at this moment. Without any heavy optimization, rooten theme could acheive a hundred in the GTMatrix test. On top of that it is fully compatible with Gutenberg and also the most effective page builder in the market – Elementor.
Use as few plugins as possible
We as a WordPress based website owner, tends to activate plugin for every single need that we encounter. But it could be done through some custom code updates on the functions.php file of our theme. We sometime try to save a hundred bucks in optimization job by a developer and loose site speed and thus loose potential customers who could pay us thousand bucks. Most of the current needs by a website owner could be covered by 2-5 plugins. Yes, you heard me right. I would recommend to install Elementor and Element Pack Pro for your content. And a caching and SEO plugin. If needed a social media plugin but in most cases you won’t need one as we have covered it in element pack pro. We are offering great deals on element pack pro. Have a look at the element pack elementor addon demos. You won’t regret for sure.
Get 20% Discount by this codeEPPROBR20
Install a caching Plugin
When a user enters a website, the hosting has to create the page using the PHP files and making some calls to the database.
Every time a visitor visits the website , in normal scenario, the hosting has to create the page again for each visit. It is too big of an effort for any server.
To improve this, cached copies of those pages are saved and the following users are served.
A caching plugin creates snapshot of your files, and regular database queries. It also keeps copies of data and objects to the user’s browser who has visited the site before. Thus it improves the loading speed.
There are many options to choose from. But we would recommend:
1) Free option: WP Super Cache or W3 Total Cache
2) Paid Option: WP Rocket.
If I had to recommend one, obviously I would recommend WP Rocket! As name suggest it makes the speed rocketing fast. No hard settings, anyone can do it. Do consider this one.
Increase WordPress memory
If your WordPress website is getting less memory from the web host or any of the setting you made, you will end up getting 500 internal server errors. Your site will be frequently getting that error plus will also time out.
I recommend that your hosting provide you with at least 256 Megabytes, which is the minimum for this CMS.
Although on certain occasions and depending on the plugins you use, you may need more.
Before making this change, find out if your hosting allows it, otherwise what you do will not help.
To increase it you must edit the wp-config.php file that will be in the public_html folder and insert the following in:
define ('WP_MEMORY_LIMIT', '256M');
The images are another of the main reasons that make the load time of a web increase.
You must optimize the images and I give you advice on how to do it.
Heavy images are one of the factors that make WordPress load times rise the most.
Although we are already using correct sizes, they may continue to slow down our website.
This usually happens because in addition to adapting the size, they must be optimized to reduce their weight.
Luckily there are many tools for this and many of them are also free.
What this type of tool or plugin does is , it takes the image and reduce its weight, but without any loss of quality.
To solve this, the ideal is to optimize all the images when they are uploaded, but obviously we can not do if we need to upload many.
So how do we do it then? There are many plugins that can do it , but if you have few images you can use WP Smush .
Just go to the plugin installer and search for WP Smush , install and activate it.
Then, You go to media – WP Smush .
You give massive Smush and all the images will be optimized.
The problem with this plugin is that it only optimizes 50 images each time you hit the button.
If your blog has many images, you can either pay for the Pro version or do it manually.
It’s paid but it’s worth it.
Do you remember the first image with https://lab.elemenetpack.pro ? It wasn’t optimized. Now with the method mentioned above, I have done an optimization and here is the result:
Now it is the time for you to speed up a WordPress site
Hopefully, you have read this post thoroughly and now can optimize your website. Please bookmark this post as I will be adding more techniques to this post. If you have any more tips on how to speed up WordPress site, please do let me know in the comment.