How To Make Fewer HTTP Requests In WordPress (2019 Guide)

How To Make Fewer HTTP Requests In WordPress (2019 Guide)

Need to make fewer HTTP requests on your WordPress site?

This just means you need to reduce how many elements (requests) load on your site.

Combining CSS and JavaScript files can help, but there are other optimizations that can reduce HTTP requests, like selectively disabling plugins that don’t need to be loaded on specific pages, disabling WooCommerce scripts and styles on non-eCommerce pages, or avoiding high CPU plugins that generate high number of requests and slow down your site.

Making fewer HTTP requests is a recommendation in GTmetrix, Pingdom, and other speed testing tools. The recommendations below will help reduce requests and make your site faster.


1. Combine CSS Stylesheets + JavaScript

Combining CSS Stylesheets + JavaScript means you need to copy/paste everything in your CSS files into 1 single file. This allows browsers to make 1 single request for a CSS file instead of multiple requests. Most cache plugins have an option to combine your CSS + JavaScript files.

Step 1: In your cache plugin settings, find the option to combine and minify CSS + JavaScript.

Step 2: Enable each setting one at a time and test results in GTmetrix.

Minify Combine CSS Files

Minify Combine JavaScript Files

Step 3: Check for visible errors on your website. If you see errors, view the source code, find the problematic files, and exclude them from your CSS or JavaScript minification settings. For example, if your slider disappears when enabling a certain setting, check your slider files in the source code and exclude the problematic file. If you don’t see errors, there is no need for this.

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.

WordPress CSS Files


2. Selectively Disable Plugins

Many plugins run across your entire site, even on pages where they’re not needed.

Contact forms, social sharing, rich snippet, slider, and some other plugins only need to be loaded on certain content types. You can disable them everywhere else using Asset CleanUp.

By disabling plugins on pages where they don’t need to be loaded, this results in fewer HTTP requests. This isn’t limited to plugins; scripts and styles can also be disabled on certain pages (eg. WooCommerce scripts, styles, cart fragments can be disabled on non-eCommerce pages).

Step 1: Install Asset CleanUp or Perfmatters (both let you selectively disable plugins).

Step 2: Edit a page or post, scroll down to the Asset CleanUp section, and review which CSS + JavaScript files are loading on the page. These can be from plugins, themes, or external scripts.

Disable WordPress External Scripts

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.


3. 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 in the previously step, you can also selectively disable WooCommerce requests loading across your entire site.

Using Asset CleanUp or Perfmatters, disable these on pages where they don’t need to load:

Asset CleanUp WooCommerce

Alternatively, Perfmatters lets you disable these in 1-click:

perfmatters woocommerce optimization


4. Avoid High CPU Plugins

High CPU plugins can generate a ton of HTTP requests.

These are usually social sharing, statistic (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.

  1. AddThis
  2. AdSense Click Fraud Monitoring
  3. All-In-One Event Calendar
  4. Backup Buddy
  5. Beaver Builder
  6. Better WordPress Google XML Sitemaps
  7. Broken Link checker (use Dr. Link Check)
  8. Constant Contact for WordPress
  9. Contact Form 7
  10. View All 65 Slow Plugins

Step 3: Replace slow plugins with faster, lightweight plugins. Research and testing is required.


5. 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.


6. Eliminate External Scripts

External scripts are anything that pull requests from outside websites.

Google Fonts can be combined into 1 file. Videos can be lazy loaded and the iframe replace with a preview image. Many scripts can be optimized, others can’t. Below are some examples.

  • Google Fonts: combine fonts and host them locally using plugins like WP Rocket, Autoptimize, OMGF, Self-Hosted Google Fonts, and Asset CleanUp.
  • Google Analytics: host tracking code locally in WP Rocket / CAOS Analytics.
  • Google AdSense: load asynchronously and try Cloudflare Rocket Loader.
  • Google Maps: take a sceenshot of the Google Map and include a link to driving directions when people click on the image (this looks just as good as a Map)!
  • Google Tag Manager: usually does more harm than good when trying to combine multiple scripts. Should only be used for large, unoptimized sites.
  • Embedded Videos: use WP Rocket or WP YouTube Lyte to lazy load videos and replace the iframe with a preview image (videos are a very heavy element).
  • Embedded Widgets + Posts: take screenshots instead of embedding them.
  • Facebook Pixel: WP Rocket can add browser caching to Facebook Pixel.
  • Gravatars: nothing worked for me besides disabling Gravatars (WP Rocket doesn’t use them on their blog either). But, you can try Harrys, FV, or the Optimum Gravatar Cache, or try breaking or hiding expandable comments.
  • Social Sharing Plugins: infamously generate requests from Facebook, Twitter, and social networks to refresh like counts. Try a faster plugin like Social Pug, Mashsharer, Social Snap, AddToAny, WP Social Sharing, or Easy Social Share


7. Combine Google Fonts

Google Fonts can be combined to generate 1 request instead of multiple requests.


The following plugins have options for optimizing Google Fonts:

  • WP Rocket
  • Asset CleanUp
  • Autoptimize
  • OMGF

The best method however, is to host Google Fonts locally. This involves downloading your fonts directly from the Google Fonts website while being minimal with the number of fonts and font weights. Next, use a tool like Transfonter or convert the fonts to web font files. You will then upload the new web font files to your wp-content/uploads folder, add the custom font to CSS, and test the font to make sure it’s working. Again, see that link for a full tutorial.



7. Minify HTML, CSS, JavaScript

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.


8. 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.

Optimize CSS Delivery


9. Defer/Load Combined JavaScript Files Asynchronously

Asynchronous JavaScript means the files load after the page is finished downloading.

This can be done using WP Rocket or Async JavaScript and should fix the remove render-blocking Javascript item. Async JavaScript gives you full control of which scripts to add an ‘async’ or ‘defer’ attribute to, while WP Rocket defers JavaScript automatically with 1 click.

JavaScript Files


10. Lazy Load Videos

Embedded videos are an external resources that generate HTTP requests.

They can take 2+ seconds to load! While you can’t completely eliminate these, you can delay the loading of videos until users scroll down (lazy load) and click the play button (light embed).

You have a couple options here: you can use WP Rocket to enable lazy loading and replace the YouTube iframe with the preview image. But if you don’t have WP Rocket, you can either try the WP YouTube Lyte plugin or follow this tutorial on light YouTube embeds. Both work well.

Here’s an example (and a great video on WordPress Speed):


11. Add 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.

Multiple CDNs = more data centers = faster content delivery and more offloading of resources. Many people start with Cloudflare then eventually look into StackPath when using multiple CDNs (I currently use both). KeyCDN is also good. This is called a “chain” of CDNs.

Setting Up Multiple CDNs
With Cloudflare, they assign you 2 namesevers which you change in your domain register. With other CDNs like StackPath and KeyCDN, they assign you a CDN URL which you will paste into the CDN URL field in your cache plugin (most of them have it) or use CDN Enabler.

Multiple CDNs


12. 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?

Minimize Redirect Errors

Common Causes

  • 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


13. Optimize Images

To reduce HTTP requests caused by images, there are 3 primary ways to optimize images:

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 ShortPixel (recommended), 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 website, 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 errros 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 width + height.


Still Need To Make Fewer HTTP Requests?

If you still need help, leave me a comment. The WordPress Speed Up Facebook Group is also helpful, or you can hire us for WordPress speed services with before + after GTmetrix reports.

WordPress Speed Up Facebook Group


span,.wp-review-57176.wp-review-percentage-type .review-list li>span{display:inline-block;position:absolute;z-index:1;top:32px;left:45px;color:#ededed;font-size:14px;line-height:1;text-shadow:0 1px 1px rgba(0,0,0,.3);-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wp-review-57176.wp-review-point-type .wpr-user-features-rating .review-list li>span,.wp-review-57176.wp-review-percentage-type .wpr-user-features-rating .review-list li>span{color:inherit;text-shadow:none}.wp-review-57176.wp-review-point-type .wpr-user-features-rating .review-list li .wp-review-input-set+span,.wp-review-57176.wp-review-percentage-type .wpr-user-features-rating .review-list li .wp-review-input-set+span,.wp-review-57176.wp-review-point-type .wpr-user-features-rating .review-list li .wp-review-user-rating:hover+span,.wp-review-57176.wp-review-percentage-type .wpr-user-features-rating .review-list li .wp-review-user-rating:hover+span{color:#fff}.wp-review-57176 .review-list li:nth-child(even){background:#fff}.wp-review-57176 .review-links{padding:30px 30px 20px 30px} .review-result-wrapper i{font-size:18px} .review-pros-cons{clear:both;padding:0;border-top:1px solid #fff} .review-pros-cons .review-pros, .review-pros-cons .review-cons{width:100%;flex:none;padding:0} .review-pros-cons .review-pros{background:#2c3fd3;padding:30px 30px 10px 30px;color:#fff;box-sizing:border-box} .review-pros-cons .review-cons{background:#5e1d9a;padding:30px 30px 10px 30px;color:#fff;box-sizing:border-box} .mb-5{text-transform:uppercase} .mb-5+p{line-height:26px}.wp-review-57176 .user-review-area{padding:15px 30px;border-top:1px solid}.wp-review-57176 .wp-review-user-rating .review-result-wrapper .review-result{letter-spacing:-2.35px} .review-title{letter-spacing:1px;font-weight:700;padding:15px 30px;background:transparent} .review-total-wrapper{width:40%;margin:0;padding:35px 0;color:#fff;background:#ededed;border-left:1px solid;text-align:center;float:right;clear:none;border-top:1px solid} .review-list{clear:none;width:60%;float:left;border-top:1px solid} .wpr-user-features-rating, .wpr-user-features-rating .review-list{width:100%;clear:both;border-top:1px solid #fff} .review-total-wrapper{padding:20px 0} .review-total-wrapper{margin:auto 0;padding-top:10px;width:auto;height:100%;clear:both} .user-review-area{padding:12px 30px} .review-list{width:100%} .review-result-wrapper{border-radius:25px} .review-percentage .review-result-wrapper, .review-percentage .review-result, .review-point .review-result-wrapper, .review-point .review-result{height:26px;margin-bottom:0;background:#fff;border-radius:25px} li .review-point .review-result{background:#5e1d9a} li:nth-of-type(2n) .review-point .review-result{background:#2c3fd3}.wp-review-57176 .review-total-wrapper,.wp-review-57176 .review-total-wrapper{width:70%;display:inline-block;margin:20px auto 0 auto} .review-total-wrapper .review-total-box{float:left;text-align:center;padding:0;color:#424242;line-height:1.5} .review-total-wrapper .review-total-box h5{margin-top:10px;color:inherit} .review-total-wrapper .review-total-box, .review-total-wrapper .review-total-box{width:100%}{color:#fff;margin-top:10px} .user-review-title{padding:15px 30px 10px;margin:0;color:inherit;background:#fff;border-top:1px solid;border-bottom:1px solid} .user-total-wrapper .user-review-title{display:inline-block;color:#424242;text-transform:uppercase;letter-spacing:1px;padding:0;border:0;background:transparent;margin-top:3px} .user-total-wrapper h5.user-review-title{margin-top:12px} .user-total-wrapper span.user-review-title{margin-top:8px} .reviewed-item{padding:30px} .review-total-wrapper>.review-total-box{display:block} .review-total-wrapper>.review-total-box>div{display:none} .user-review-area .review-percentage, .user-review-area .review-point{width:20%;float:right;margin-bottom:5px}.wp-review-57176 .review-embed-code{padding:10px 30px},.wp-review-57176 .review-title,.wp-review-57176 .review-list li,.wp-review-57176 .review-list li:last-child, .review-list,.wp-review-57176 .user-review-area, .review-total-wrapper,.wp-review-57176 .reviewed-item,.wp-review-57176 .review-links,.wp-review-57176 .wpr-user-features-rating, .user-review-title{border-color:#fff}.wp-review-57176 .wpr-rating-accept-btn{background:#5e1d9a;margin:10px 30px;width:-moz-calc(100% – 60px);width:-webkit-calc(100% – 60px);width:-o-calc(100% – 60px);width:calc(100% – 60px);border-radius:50px}@media screen and (max-width:480px){ .review-title, .reviewed-item, .review-list li, .review-desc, .user-review-area, .review-embed-code{padding:15px}.wp-review-57176.wp-review-circle-type .review-list li{padding:15px 15px 0 15px} .review-pros-cons>div>div{padding:15px;padding-top:0} .ui-tabs-nav{padding:0 15px} .review-links{padding:15px 15px 5px} .review-list, .review-total-wrapper{width:100%} .review-total-wrapper{padding:10px 0} .review-total-wrapper .review-total-box h5{margin-top:0} .review-total-wrapper .review-total-box div{line-height:1}}]]>

Keep reading the article at Tom Dupuis. The article was originally written by Tom Dupuis on 2019-12-30 15:37:38.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

Your email address will not be published. Required fields are marked *

Show Your ❤️ Love! Like Us
Scroll to Top