If you want to speed up your WordPress site, there are often a 1001 things which need to be done, and most self builders find that it can become a bit of a drama when they start to take a look at things and what was initially a straightforward build looks like an apocalyptic nightmare on steroids! So you build a shiny website, go all out and add WooCommerce, Google Tag Manager, OneSignal, Helpdesk, Yoast, Live Radio, Cookie Notice, Social Media, and a bunch of other goodies.
But then things became unbearably slow, you fire up GTMetrix to flush out the issue and start to get a severe case of palpitations because it looks like this!
Not very impressive? Indeed not! You want to score a perfect A, and reduce page load time to under two seconds at minimum
So, you hit the re-test button, but guess what? Still the same sickening result, so next you test the website on Pingdom because GTMetrix can suck it. But, below are the dismal results, once again:
It can get exasperating. The proverbial thorn in most self builders flesh is the errant HTTP requests, as many of the other issues can probably be fixed quickly.This brings us to the question:
How can you reduce HTTP requests on a WordPress site?
Every time you visit a WordPress website, a lot of data moves between your browser and the website’s servers. In other words, WordPress makes HTTP requests to various servers to build what users see when they load your site. If your WordPress site requires a lot of elements to load, you will have more HTTP requests and vice versa. More HTTP requests mean a slow website, poor user experience (UX), bad SEO scores, and low conversion rates. WordPress websites are usually dynamic, meaning it takes a lot of different parts to render your website in a browser. The good news is you can reduce HTTP requests and speed up your site significantly.
Reports from GTMetrix and Pingdom usually show you where the problem lies. As such, test your site using both tools to find out the areas you must improve. With your reports ready, here’s how to reduce HTTP/S requests and speed up your WordPress site.
If you have a lot of stuff on your WordPress website, you will have too many HTTP requests. It’s a no brainer. The first step to reducing HTTP requests is decluttering.
If you have a ton of plugins, you’ll most definitely have more HTTP requests. The fewer the plugins, the fewer the requests. It’s fairly simple.
What to do?
Carry out an audit of your plugins. Which plugins must you have to run your website? Are there plugins you don’t need? Do you have plugins that tap into third-party servers? Can you do without these plugins?
To reduce HTTP requests, uninstall all the plugins you don’t need. If you need a plugin occasionally, install it only when you need it. Afterward, uninstall the plugin.
The same goes for WordPress themes and content you don’t use. Clean all that stuff out. Remove anything you don’t need; it’s good for your website speed and security.
You can go the extra mile and load plugins selectively. For instance, if you only need Contact Form 7 to load on your contact page, you can stop other plugins from being loaded on that specific page.
That would be awesome, don’t you agree? And to think you only need the Asset CleanUp WordPress plugin.
The plugin is easy to use and quite efficient. Or as the developer puts it:
“Asset CleanUp” scans your page and detects all the assets that are loaded. All you have to do when editing a page/post is just to select the CSS/JS that are not necessary to load, this way reducing the bloat.
Clean up your install, get rid of the junk – comment spam included. Oh, and eliminate broken links and optimize your database while at it as well. These are significant areas to consider as far as boosting your site speed goes.
A website without images is, well, drab. They say a picture speaks a thousand words, and that’s cool. But every image accounts for an HTTP request. To add salt to injury, images are top among elements that take long to load.
Still, we can’t ignore the fact that most WordPress themes (read sites) rely on images, and many images for that matter. So, in light of this, how can you reduce HTTP requests by optimizing your images?
For starters, get rid of all the images you don’t use. Be ruthless; get rid of all that bloat – you don’t need it. After that, compress and optimize images to remove unnecessary file data.
While there are a number of plugins to choose from, we really like WP Compress. While it is a premium service, the powerful auto optimization of images, lossless compression, cloud processing to reduce your server load, WebP image support, automatic resizing and more make the investment well worth it. Plus you can get started with 100 images for free – so you can at least give it a try.
Optimizing images doesn’t reduce your HTTP requests per se, but it reduces the size of your image files, which translates to better page speeds down the line.
Alternatively to reduce HTTP requests, leverage the power of CSS image sprites. To the uninitiated, a sprite is a collection of images put into a single image file.
Then using CSS tricks, you can choose which part of the image to show. But how does this reduce HTTP requests? Here’s an analogy.
Say you needed five images on your homepage. To load your site, your WordPress install will make five trips to the server to get the images. Now, if you put all the five images in a single image file (sprite), your WordPress install will make only one trip.
Do you see where I am going with this? The fewer the trips, the lesser the HTTP requests. The best part is you needn’t sweat to create and implement CSS image sprites. You can use a tool such as CSS Sprite Generator. Implementing CSS image sprites is easy, provided you know your way around CSS.
Pro Tip: You can forget all about CSS image sprites if your website uses HTTP/2 that supports asynchronous loading of images and scripts. GTMetrix doesn’t take HTTP/2 into account when scoring performance, so don’t worry if it seems your images are creating a ton of HTTP requests.
But I say: If CSS image sprites can reduce HTTP requests significantly on your site, and you know how to implement the same, go for it and strike those extra seconds off your page load time. Whether or not you have HTTP/2.
After all, a single image file requires a single HTTP request. Ten separate images need 10 HTTP requests and so on. I know you get the drift.
If I combine and minify those 44 JS and 22 CSS files, I can reduce my HTTP requests significantly, the size of the website, and the time it takes to load. But what is this “combining” and “minifying” business all about?
Again, Raelene says:
Do you get it? I sure do hope so. Combining files reduces HTTP requests. Minification, on the other hand, reduces the file size. Combine the two, and you kill two birds with the same stone.
Are there plugins? Yes, of course!
There are a ton of WordPress plugins to combine and minify your files. A good example is the WP Rocket plugin. It’s basically one of the best caching plugins offering you features to combine and minify files in a few clicks.
Another popular (and free) option is the Autoptimize plugin.
By the way, while at it, reduce the number of external CSS files and JS scripts? For instance, and we’re not mentioning names here, do you really need a third-party comment platform? Do you need a live radio plugin?
It doesn’t matter what I say, eliminate all external scripts and files you don’t need.
In some instances, combining files might not be an option, especially for third-party files and scripts that change frequently. In such cases, you can defer the loading of such assets. HTTP/2 supports asynchronous loading of files, which means all files load simultaneously.
If you don’t have asynchronous loading going on for some reason (perhaps you aren’t using HTTP/2, or the scripts are not asynchronous), these files can slow your website significantly.
Keep in mind that your web pages load from top to bottom. If you have render-blocking CSS and JS at the top of your page, the browser will stop loading until the files have been loaded fully. As such, users will see a blank page until the scripts load, which takes time.
How? Move all render-blocking scripts from the top to the bottom of your web page. But be careful here; you don’t need to move all scripts to the bottom. I say this since your page might need CSS and JS to deliver a thoroughly engaging experience.
So, only defer scripts that aren’t necessary for the page to load. That way, your users won’t wait ages for your page to load. Why? Because you will need fewer HTTP requests to deliver your message.
It doesn’t reduce HTTP requests per se (because all scripts and files will load eventually), but it reduces the number of HTTP requests needed to render your page.
It is very much like lazy loading for images; the image is only loaded when it’s in the viewport, not when the rest (and most important parts) of the page is loading.
By the way, fixing render-blocking CSS & JS might reveal files and scripts you don’t need to build a web page.
For instance, if some external social sharing JS script is taking long to load, you can defer it. On top of that, you can eliminate it and build social sharing into your theme.
You will eliminate HTTP requests and speed up your site while retaining the same functionality. I understand coding features into your theme is a tall order for most beginners, so check with an advanced WP user or developer.
As an alternative, you can use the WP Rocket plugin to fix render-blocking scripts, but be careful. Read their documentation because if you mess things up, you can break your website easily.
Use Caching & CDN
Did you know caching and CDNs can reduce your HTTP requests? It’s doesn’t seem like a fact at first, but when you consider what happens behind the scenes, you can use caching and CDN to your advantage.
Caching involves storing static files on a browser so that users don’t download the files on subsequent visits. Say you have a cache plugin, and the user downloads your cached content on their first visit.
On subsequent visits, your site won’t make requests to the server. Instead, it will serve the cached resources from the browser, reducing HTTP requests, and boosting your site’s speed.
A CDN (or Content Delivery Network) is a network of servers placed around the world. A CDN uses caching as well, but for even faster speeds, the CDN provider serves your cached content from a server that’s closest to the visitor.
Shorter distances mean faster content delivery, and caching means your website doesn’t need to download the same content from the central server all over again. Does it make sense to you?
And best of all there are a number of free CDN options (or at least free trials so you can quite literally see the difference it makes). At Xhostcom we use and highly recommend Cloudflare, but choose the CDN you feel works best for you.
Extra Bit: Ensure HTTP/2 is Supported
You might be doing everything to reduce HTTP requests, but your web host could be the cause of your woes. Don’t be surprised; asking and thinking, who – in this time and age – uses anything but HTTP/2?
You probably don’t even know what HTTP/2 is all about. Well, for starters, HTTP/2 supports the asynchronous loading of files, among other things. It has other benefits over HTTP 1.0, but that’s a lesson for another day.
If you use HTTP 1.0 or lower, you will notice a considerable number of HTTP requests.
Don’t be quick to judge; I have seen web hosting providers who still use HTTP 1.0 and older versions of PHP. Yes, even with the apparent benefits of HTTP/2 and PHP 7. I’m not even bluffing; some of their customers come to me when some of their plugins don’t work, and it’s irritating!
But, really, why? The fact that some web hosting providers are not bothered by the fact that PHP 5.6 is deprecated and has security vulnerabilities is just something else. And if they don’t support HTTP/2, that’s a deal-breaker for yours truly.
Contact your host or use KeyCDN’s tool to check if your server supports HTTP/2. The best web host supports HTTP/2 and the latest version of PHP. If your host is lagging in both cases, ask them to upgrade or choose a better web host.
Reducing HTTP requests on your WordPress site is all about eliminating things that you don’t need. If you have a lot of stuff on your WordPress website, you will have a lot of HTTP requests and relatively slow page speeds.
To reduce HTTP requests, declutter your site, optimize images, fix render-blocking scripts, use caching, and ensure your host supports HTTP/2. Other than that, endeavor to create simple and clean websites that don’t require a ton of assets to load.
If you have questions, please let me know in the comment section below and if you enjoyed this post, why not check out this article on How To Scale Wordpress For High Traffic Sites!