The slower your website, the less people are willing to use it. And the less users you have, the less traffic and conversions you get. At least, that’s what the research by Amazon, Walmart, Akamai and Aberdeen Group proves.
The main culprit that slows down your website are the HTTP-requests. Browser sends one of those for each element of the web page. Add the fact that the requests are sent not simultaneously, but sequentially. Therefore, the more elements (images, music, etc.) you have on the web page — the longer the loading speed.
You can learn why it happens in an article 9 ways to speed up the loading of your website that discusses the most common reasons for slow website loading and how to deal with them properly.
In context of WordPress
WordPress is rather well optimized by itself. But the more content the website has, the slower it becomes. So, let’s discuss some techniques that will help your website not to slow down with its age and even regain some of its speed.
Use cache
Every website has elements that repeat on every page. For example, a logo. Or the main CSS file. And there is simply no need to load them from the server each time, over and over, increasing the loading time.
And that’s what the cache is for. Cache is a copy of some website’s elements on the client device. The process of creating this copy is called caching. When a computer has cache, client doesn’t download the cached elements from the website, but takes them from the cache instead. This leads to lesser amount of requests sent and faster loading time.
You can also increase the speed of the server procedures. By default, the hosting that contains your website, doesn’t keep the web pages. It keeps only the PHP scripts that contain instructions on how to create the pages, and remakes them each time the user requests a page. It is done to save the storage space, but the drawback is in increased load on the server and longer loading times.
That’s why you should use supercaching. It is a technique, that allows the server to make the web pages in advance and keep them in a separate folder. They will take up more storage space, but the performance of the server and the loading times will greatly improve.
IMPORTANT. Despite all the advantages of the caching, you should be careful about it. When you change the elements that has already been cached, no one will see any changes until the cache is updated. Which means that if you regularly update, for example, the header of your website — you should turn the caching off for it.
The best plugin for caching and supercaching is WP Super Cache. It automatically detects which elements of the page should be cached and which caching method will be a better fit for it.
Here are the settings of WP Super Cache that I use on my website.
Switching to Expert mode would give me a very little boost in loading speed, but in order to use it correctly, I’d have to edit the configuration files on my hosting. Which is something I prefer not to do without a good reason.
Make the web page load sequentially
By default, the browser downloads the complete web page and only then shows it to the user. Which takes quite a lot of time if the page has a lot of content, and may lead to user just closing the tab before the page loads.
The solution lies in sequential (or so called lazy) loading. In this case, the browser will load only the elements of the page the user can see right now. The rest will be loaded as needed. So while the overall loading speed of the page does increase, the user gets the page much faster and doesn’t have to wait for the pictures in the footer to load.
In order to turn on the sequential loading, you need a plugin Rocket Lazy Load. Just install it, activate it and check two marks in the settings.
Combine the styles and scripts
JavaScript and CSS are the foundation of the modern web design. But a lot of webmasters can’t use them correctly. They paste them in-line with the rest of the code, instead of creating a separate file and calling them in from it. The server wastes more resources to process the in-line styles and scripts, while the code of the web page itself becomes much harder to read.
The best solution would be to write better code. But if you already have a website where you use inline CSS and JavaScript — it still needs to be fixed.
The best way to do it is to rewrite the code manually. But if you are not familiar with CSS, HTML and JS and have no means or desire to hire a specialist — you can use a plugin instead.
I prefer Merge + Minify + Refresh. It automatically combines all styles and scripts on your website and pushes them from in-line to separate files.
The plugin has many insteresting settings, but if you do not know how HTTP works — do not change them. Just install the plugin and activate it, the default settings are decent enough.
Disable hotlinking
What do you do when you find a funny picture on the internet and want to use it on your website? The right way to do it is to download the image on your website and only then share it with the world. Like this:
img src="image.jpg" height="1080" width="1920">
But most people just right-click the image, copi its address and post it on their website. Like this:
img src="http://somebodyswebsite.com/image.jpg" height="1080" width="1920"
Now, each time their page is loaded, the picture is grabbed from its native server. And the website on that native server gets slower due to having to process unrelated outside requests.
This is called hotlinking and is a huge breach of web building etiquette. In order to prevent someone from hotlinking your media, you should turn the hotlinking off on your website. If people want to share — let them link directly to your website and bring you traffic.
There are special image hostings. For example, Imgur. You can and actually should hotlink from them, since that is the whole purpose of those websites. So if you want to share a picture and not waste your storage space on it — go to Imgur and post the link from there.
In order to protect my website from unethical behaviour, I use All-In-One WP Security and Firewall. It’s a light, but pretty great plugin that protects my website from bruteforcing, secures the accounts of my users, blocks connections with already known hackers and protects from hotlinking.
In the plugin’s settings, hotlinking protection can be enabled in Firewall > Prevent hotlinks:
But I recommend you to walk through all the menus and enable the recommended settings.
Optimize the database
Database contains all the info about your website. It contains posts’ contents, comments, settings and many other things. If you want to, you can restore the website from the database only and you will lose only the mediafiles that were kept directly on the website.
But there’s a problem. WordPress database grows with time and gets filled with trash. And the larger the database — the slower the website.
I solve this problem with Advanced Database Cleaner plugin. It deletes:
- Old revisions and drafts of my posts.
- Unapproved comments, spam and comments in the Trash.
- Unused tags and metadata — for example, from deleted posts and comments.
The thing I like the most is an ability to automate the clean-up:
And optimization:
Premium version of the plugin also can delete the unused values in the tables that are left from deleted plugins and themes. But I already use the plugins very carefully and do not install anything I do not need.
Use only the themes that come from reliable sources
WordPress theme engine has a lot of features. With it, you can make your website look like literally anything and then publish this design to the web, for anyone to use. But it’s not all sunshine and rainbows — quite often, theme not only gives your website its own atmosphere, but also serves as the main resource hog.
I have two rules for picking a theme for a website:
- Fear the themes from newbies. WordPress is not fool-proof. Nothing stops the theme author from using full-size images in the theme instead of CSS, utilize in-line scripts and styles and overall forget about optimization.
That’s why when I pick a theme, I look not only at the screenshots, but at the reviews too. And if other users are not satisfied with the performance — I’d rather keep looking.
- Don’t prioritize bells and whistles. Pretty animation are interesting only the first couple times. Afterwards, users stop caring about the way your menu expands — they’ve come to your website for the content and not to look at the menu.
So if your decorative elements slow the website down — remove them now, despite however cool they look.
Remove all unnecessary plugins
Plugins are the add-ons for WordPress. And that means that they need additional resources to work properly. The more plugins the more of a resource hog your website becomes.
That’s why the plugins are evil. Even despite the fact that I want you to install a couple plugins myself — it’s only because they speed your website more than they slow it down.
So, if your website can function without a plugin — you don’t need it. Especially when it comes to plugins that add animation and other decorative elements to the website.
You can check how much does the website slow your website down with Plugin Performance Profiler.
Connect your website to the CDN
CDN is a content distribution network that improves your website’s loading speed for user from other countries.
CDN won’t help if your website is just slow by itself. But if you promote your website abroad, CDN is the best possible solution.
The most popular CDN is CloudFlare. Our review on it and a manual on connecting it to WordPress can be found at What is Cloudflare and how it speeds up your website.
Finally, you can just admit defeat and upgrade to a better hosting plan. Or directly to the VPS, if your website is really heavy. But before you start throwing money at the problem, try optimization. Trust me, the results will surprise you.