Need to make fewer HTTP requests in GTmetrix YSlow?
How To Make Fewer HTTP Requests In WordPress
- Combine Google Fonts
- Lazy Load Images + Videos
- Optimize Third Party HTTP Requests
- Use A Lightweight Social Sharing Plugin
- Selectively Disable Plugins
- Avoid Slow Plugins That Generate Requests
- Use WP Rocket To Make Fewer HTTP Requests
- Use A CDN
- Minimize Redirects
- Optimize CSS Delivery
- Disable WooCommerce Scripts, Styles, Cart Fragments
- Optimize Images
- Replace Plugins With Code
Step 2: Enable each setting one at a time, then test results in GTmetrix.
Alternatively, you can manually combine your CSS files in WordPress under Appearance → Theme Editor. You would simply copy and paste the contents in all files into 1 single CSS file.
2. Combine Google Fonts
Google Fonts can be also combined to generate fewer requests.
Step 1: View your GTmetrix Waterfall report to see how many font files are being loaded.
Step 2: Enable Google Font optimization in your cache plugin. As said in WP Rocket, this “combines multiple font requests to reduce the number of HTTP requests.” If your cache plugin doesn’t have an option to combine fonts, try the OMGF of Self-Hosted Google Fonts plugin.
Step 3: Consolidate your fonts, weights, and font icons. In GTmetrix, you may notice each font, weight, and icon creates their own request. Try to use only 1 font and only a couple weights. Font icons can be created by plugins like Elementor, such as the arrows in my navigation menu.
Step 4: Preloading tells browsers to start downloading a resource as soon as possible and should reduce font load times in GTmetrix Waterfall. You can do this with plugins like WP Rocket, Perfmatters, or Pre* Party Resource Hints. Simply copy the font URLs from GTmetrix Waterfall, paste them in the preloading section, then retest your font’s load times in GTmetrix.
3. Lazy Load Images + Videos
Lazy loading images eliminates all HTTP requests from images since they’re only loaded when you scroll down and see them. If you use many images, this significantly reduces HTTP requests.
Lazy loading videos eliminates most HTTP requests from embedded videos. But since thumbnails often create external requests, you may still see minor GTmetrix errors for leveraging browser caching and add expires headers (see Elementor section below to fix it on Elementor).
Lazy Load In WP Rocket – enable lazy loading and replace iframe with a preview image.
Lazy Load In SG Optimizer – enable all lazy load options in the Media Optimization settings.
Lazy Load In Elementor – I followed this video by WPCrafter and was able to get videos creating 0 errors in GTmetrix (not even browser caching or expires headers issues). You will need Elementor Ultimate Addons, then use the native Elementor video element to load the video. The key here is to upload a custom thumbnail directly to your website (through Elementor) so your website doesn’t have to go to YouTube to load the thumbnail. You can even customize the arrow buttons and branding on your embedded videos. It’s brilliant. My blog doesn’t use Elementor so you will still see errors for videos on my blog, but I promise it works!
If you’re not using either of these plugins, try WP YouTube Lyte for lazy loading videos.
4. Optimize Third Party HTTP Requests
Third party scripts are anything that pull requests from outside websites.
They can be Google Fonts and embedded YouTube videos (which I covered) but other requests can be created by Google AdSense, embedded Maps, Tag Manager, Facebook Pixel, Gravatars, even “like counts” on social sharing plugins. Some are easy to optimize, others are impossible.
- Google Fonts: covered in section 2.
- Google Analytics: using the Flying Scripts plugin to host locally.
- Google AdSense: load asynchronously and try Cloudflare Rocket Loader.
- Google Maps: only use on your contact and localized pages. Alternative, you can take a screenshot of the Google Map and include a link to driving directions when people click on the image (this looks almost just as good as the Map itself)!
- Google Tag Manager: usually does more harm than good when trying to combine multiple scripts. This should generally only be used for large, unoptimized sites.
- Embedded Videos: covered in section 3.
- Embedded Widgets + Posts: take screenshots instead of embedding them.
- Facebook Pixel: enable Facebook Pixel add-on in WP Rocket (only way I know).
- Gravatars/Comments: using the Flying Scripts plugin to create a timeout for Gravatar loading which should make these 100% in GTmetrix. This plugin can be used to create timeouts for other scripts too. For wpDiscuz, tweak the settings.
- Social Sharing Plugins: covered in section 5.
Prefetching External Requests – the final step is to view all your third party scripts from the “reduce DNS lookups” section in GTmetrix YSlow, copy their URLs, and prefetch them using a plugin like WP Rocket, Pre* Party Resource Hints, or Perfmatters. This helps load them faster.
5. Use A Lightweight Social Sharing Plugin
Many social sharing plugins create HTTP requests from Facebook, Twitter, etc.
I recommend Grow by Mediavine (Social Pug) since it only created 1 single request when I tested it (though I ultimately disabled it because even 1 request was too much since I’m a speed nerd). But that plugin was also rated the #1 fast social sharing plugin by WP Rocket. Take a look at WP Rocket’s list and use a lightweight plugin that doesn’t create lots of requests in GTmetrix.
6. Selectively Disable Plugins
Many plugins run across your entire site, even on pages where they’re not needed.
Asset CleanUp and Perfmatters let you disable plugins, scripts, and styles on specific pages/posts. I like Perfmatters (by Kinsta) since it also lets you remove WordPress bloat. By disabling plugins on content where they don’t need to load, this results in fewer HTTP requests.
- Disable slider plugin on pages that don’t use sliders
- Disable rich snippets plugin on pages that don’t use rich snippets
- Disable contact form plugin on pages that don’t have a contact form
- Disable affiliate link management plugin on pages that don’t use aff links
- Disable social sharing plugin on all pages (since it’s usually for blog posts)
Step 1: Install Asset CleanUp or Perfmatters (both let you selectively disable plugins).
Step 3: Disable all plugins and requests you don’t need on that page. You can disable them on 1 single page, across your entire site, by post type, or use RegEx (regular expressions) to disable them on specific URL patterns. RegEx is only included with Perfmatters or Asset CleanUp Pro.
7. Avoid Slow Plugins That Generate Requests
High CPU plugins can generate a ton of HTTP requests.
These are usually social sharing, statistics (analytics), sliders, portfolios, page builders, calendars, chat, and contact form plugins. Basically, avoid any plugin that pulls external requests from outside websites, runs ongoing processes, or just takes a long time to load.
Step 1: Check for slow plugins in GTmetrix Waterfall or Query Monitor.
Step 2: Avoid known high CPU plugins.
- AdSense Click Fraud Monitoring
- All-In-One Event Calendar
- Backup Buddy
- Beaver Builder
- Better WordPress Google XML Sitemaps
- Broken Link Checker
- Constant Contact for WordPress
- Contact Form 7
- View All 65 Slow Plugins
Step 3: Replace slow plugins with faster, lightweight plugins. Research and testing is required.
8. Use WP Rocket To Make Fewer HTTP Requests
WP Rocket has many optimization features not included with other cache plugins, and I definitely recommend using it if you’re serious about making your WordPress site load faster.
Making sure you have properly configured settings can make a big difference. The file optimization and add-on settings are especially helpful in making fewer HTTP requests.
9. Use A CDN
CDNs can help make fewer HTTP requests.
Instead of making your origin server respond to a request, a CDN’s data centers will offload bandwidth while lightening the load on the origin server. Cloudflare is free, so it’s a no-brainer.
I recommend either using Cloudflare or WP Rocket’s RocketCDN. Both have their pros and cons but I personally use RocketCDN which uses StackPath’s data centers. RocketCDN is set up automatically once you purchase it in WP Rocket, Cloudflare requires changing nameservers.
If using Cloudflare, be sure to check out my recommended page rules.
10. Minimize Redirects
Unnecessary redirects can cause extra HTTP requests.
You will need to look at your GTmetrix report to see what’s causing this error. Is it being generated by an external script or plugin on your site? Have you tried optimizing that script or looking for a more lightweight plugin? Is it because you changed your domain version to non-WWW or HTTPS but haven’t updated all links/images on your site to reflect the new version?
- Bad plugins
- External scripts
- Changed to WWW vs Non-WWW but haven’t updated links
- Changed to HTTPS vs non-HTTPS but haven’t updated links
11. Optimize CSS Delivery
This should fix the render-blocking resources item in PageSpeed Insights.
WP Rocket, Autoptimize, and other similar plugins should have an option to optimize CSS delivery. Simply go into your settings and make sure you have this enabled, and it should fix it.
Minifying files is usually done by your cache plugin (see step 1).
But sometimes, this can break your website. In this case, you would have to test each setting one by one, check for problematic files in the source code, then exclude those files from minification using your cache plugin. If you don’t see visible errors, you don’t need to do this.
14. Disable WooCommerce Scripts, Styles, Cart Fragments
WooCommerce sites naturally generate more HTTP requests.
Not only do they typically require more plugins, but they also load extra WooCommerce scripts, styles, and cart fragments. Just like you can selectively disable plugins from the previous step, you can also selectively disable WooCommerce requests from loading across your entire site.
Using Asset CleanUp or Perfmatters, disable these on pages where they don’t need to load:
Alternatively, Perfmatters lets you disable these in 1-click:
15. Optimize Images
There are 3 primary ways to optimize images in GTmetrix. These won’t reduce the number of HTTP requests, but they will reduce the size of the requests, therefore improving load times.
Serve Scaled Images: resize large images to be smaller. GTmetrix tells you which images are too large and the correct dimensions they should be cropped/resized to. Try creating an image dimension cheat sheet by measuring the dimensions of your sliders, full width blog images, widgets, and other areas of your website. Then make sure to resize images to those correct dimensions before uploading. If you do this, you should never have serve scaled image errors.
Optimize Images (Lossless Compression): use a plugin like TinyPNG (what I use), ShortPixel, Smush, or Imagify to compress images. Although these plugins say lossless, you may sometimes notice a small loss in quality. That’s why it’s best to backup your images and test a couple of them before bulk optimizing all images on your site, to make sure you’re happy with the quality.
Specify Image Dimensions: add a width + height to the image’s HTML or CSS. This is automatically done in the Visual Editor, but not custom HTML, some page builders, and possibly other areas of your WordPress site. GTmetrix will show you which images have these errors and provide you with their correct dimensions. To fix the error, you will need to locate the image in your WordPress dashboard, edit the HTML or CSS, then add the appropriate width + height.
<img src="example.jpg" width="680" height="680" />
16. Replace Plugins With Code
You can avoid many plugins by replacing them with code.
- Google Fonts: host your fonts locally
- Google Analytics tracking code: insert manually
- Table of contents: design it manually in HTML + CSS
- Embedded Tweets or Google Maps: take a screenshot instead
- Embedded Facebook widget: replace with actual Facebook widget
Consolidating plugins also helps. One classic example is using WP Rocket which comes with hosting fonts, analytics, and Facebook Pixel locally, lazy loading images + videos, database cleanup, preloading, heartbeat control, and integration of both Cloudflare and multiple CDNs. With other cache plugins (since most of them don’t have these features), you would need to install 6-7 extra plugins to get those speed optimizations, when they’re built-in to WP Rocket.
Still Need To Make Fewer HTTP Requests?
Frequently Asked Questions
How do you make fewer HTTP requests in WordPress?
How do you optimize third party requests?
WP Rocket can optimize Google Fonts, Google Analytics, Facebook Pixel, and embedded YouTube videos while also giving you options to preload and prefetch them. The Flying Scripts plugin can create timeouts for third party requests (like Gravatars and comments) to bring them to 100% in GTmetrix. Google AdSense and Tag Manager are more difficult.
Does lazy loading reduce HTTP requests?
Yes, lazy loading images can completely eliminate all requests for most images. Lazy loading videos and replacing the YouTube iframe with a preview image (in WP Rocket or Elementor) prevents your site from having to make a third party request.
Thanks for reading :)