WP AI Agent
Features Pricing Blog Contact Download Plugin Manage Subscription Get Free Key →

How to Reduce HTTP Requests in WordPress: A Complete Guide

· · 9 min read

Learning how to reduce HTTP requests in WordPress is one of the most impactful performance optimisations you can make for your website. Every time a visitor loads a page, their browser sends a separate HTTP request for each file — CSS stylesheets, JavaScript files, images, fonts, and more. The more requests your site makes, the longer it takes to load, which hurts user experience and search engine rankings.

Why HTTP Requests Matter for WordPress Performance

HTTP requests are the foundation of how browsers fetch web page resources. When a browser loads your WordPress site, it sends individual requests to the server for every asset referenced in your HTML. A typical unoptimised WordPress page can generate 80–150 HTTP requests, causing noticeable delays even on fast connections.

Reducing the number of requests has a direct impact on:

  • Page load time — fewer round trips to the server means faster rendering.
  • Core Web Vitals — metrics like Largest Contentful Paint (LCP) and Time to First Byte (TTFB) improve significantly.
  • SEO rankings — Google uses page speed as a ranking signal.
  • Bounce rate — faster pages keep visitors engaged and reduce abandonment.

How to Measure Your Current HTTP Requests

Before optimising, you need a baseline. Use these tools to count your current HTTP requests:

  1. Open your WordPress site in Google Chrome.
  2. Press F12 to open Chrome DevTools.
  3. Click the Network tab.
  4. Reload the page with Ctrl+Shift+R (hard refresh).
  5. Look at the bottom status bar — it shows the total number of requests.

Alternatively, tools like GTmetrix, Pingdom, and Google PageSpeed Insights provide detailed waterfall charts breaking down every request your page makes.

Combine and Minify CSS and JavaScript Files

The most common source of excessive HTTP requests in WordPress is the large number of separate CSS and JavaScript files enqueued by themes and plugins. Combining these files into fewer bundles and minifying their content is the single most effective way to reduce request count.

Using a Caching Plugin to Combine Files

Plugins like WP Rocket, Autoptimize, and W3 Total Cache can automatically combine and minify your assets. Here is how to do it with Autoptimize:

  1. Install and activate Autoptimize from the WordPress plugin directory.
  2. Go to Settings > Autoptimize in your dashboard.
  3. Check Optimize JavaScript Code and enable Aggregate JS-files.
  4. Check Optimize CSS Code and enable Aggregate CSS-files.
  5. Click Save Changes and Empty Cache.
  6. Test your site in a staging environment before going live to catch any visual regressions.

Manually Dequeuing Unnecessary Scripts

Many plugins load scripts and styles on every page, even when they are not needed. You can dequeue them with a PHP snippet in your theme's functions.php file or a custom plugin:

/**
 * Dequeue unnecessary scripts and styles on non-relevant pages.
 */
function mytheme_remove_unused_scripts() {
    // Remove Contact Form 7 scripts from all pages except the contact page
    if ( ! is_page( 'contact' ) ) {
        wp_dequeue_script( 'contact-form-7' );
        wp_dequeue_style( 'contact-form-7' );
    }
}
add_action( 'wp_enqueue_scripts', 'mytheme_remove_unused_scripts', 99 );

Use Chrome DevTools or a plugin like Query Monitor to identify which scripts and styles are loaded on each page, then dequeue the ones that are not relevant to that page's functionality.

Optimise and Lazy Load Images

Images often account for the majority of a page's total weight, and each image is a separate HTTP request. Optimising how images are served can dramatically cut your request count and file size simultaneously.

Enable Native Lazy Loading

WordPress 5.5 and later adds the loading="lazy" attribute to images automatically, deferring off-screen images until the user scrolls to them. Verify this is working and extend it to iframes:

  1. Confirm your WordPress installation is version 5.5 or higher.
  2. Install Lazy Load by WP Rocket or use the built-in WordPress lazy loading attribute.
  3. To add lazy loading to iframes (such as YouTube embeds), add the following to functions.php:
    add_filter( 'the_content', function( $content ) {
        return str_replace( '<iframe', '<iframe loading="lazy"', $content );
    });
  4. Test using Chrome DevTools Network tab — images below the fold should no longer appear in the initial request waterfall.

Use CSS Sprites and Inline SVGs

CSS sprites combine multiple small images — such as icons — into a single image file, replacing many requests with one. For small vector icons, inline SVG directly in HTML eliminates the request entirely. Many modern icon libraries (such as Heroicons) provide ready-to-use inline SVG code you can paste straight into your templates.

Serve Images in Next-Gen Formats

Convert images to WebP or AVIF format using a plugin like Imagify or ShortPixel. These formats deliver smaller file sizes without quality loss, and since they are served from the same URL via the server or a CDN, they reduce both request size and response time without adding extra requests.

Leverage Browser Caching and a CDN

Browser caching instructs the visitor's browser to store static assets locally so that on subsequent page loads, those assets are loaded from the local cache instead of generating a new HTTP request to your server.

Set Cache-Control Headers

Add the following to your .htaccess file (Apache servers) to set long cache expiry times for static assets:

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-font-woff2 "access plus 1 year"
</IfModule>

Use a Content Delivery Network (CDN)

A CDN stores copies of your static assets on servers around the world and serves them from the node closest to each visitor. This reduces latency and, when combined with HTTP/2 multiplexing, reduces the effective cost of each individual request. Popular choices for WordPress include Cloudflare, BunnyCDN, and KeyCDN.

  1. Sign up for a CDN provider and create a pull zone pointing to your WordPress domain.
  2. Install the CDN provider's WordPress plugin or a general CDN plugin like CDN Enabler.
  3. Configure the plugin to rewrite static asset URLs to your CDN domain.
  4. Purge the WordPress cache and verify asset URLs in the browser DevTools Network tab.

Reduce External Scripts and Third-Party Requests

Third-party scripts — analytics platforms, social sharing buttons, chat widgets, and advertising networks — each introduce at least one additional HTTP request and often several. They also introduce latency that is outside your control because the request must travel to an external server.

Audit and Remove Unnecessary Third-Party Scripts

  1. Open Chrome DevTools > Network and filter by domain to see all third-party requests.
  2. Identify scripts that are no longer in use — old A/B testing tools, abandoned social widgets, or redundant analytics snippets.
  3. Remove them from your theme, plugin settings, or tag manager.
  4. Re-test to confirm the requests have been eliminated.

Host Google Fonts Locally

Google Fonts generates two external HTTP requests: one for the CSS and one for each font file. Hosting fonts locally eliminates those external requests entirely.

  1. Visit google-webfonts-helper.herokuapp.com and download your chosen font files in WOFF2 format.
  2. Upload the font files to your theme's /fonts/ directory.
  3. Remove the Google Fonts <link> from your theme or use a plugin like OMGF (Optimize My Google Fonts) to automate this process.
  4. Define the @font-face rules in your theme's CSS pointing to the local font files.

Load Scripts Asynchronously or Defer Them

Even when third-party scripts are necessary, loading them asynchronously prevents them from blocking page rendering. Use WP Rocket's Load JS Deferred option or manually add defer attributes via a filter:

add_filter( 'script_loader_tag', function( $tag, $handle, $src ) {
    $defer_scripts = array( 'google-analytics', 'facebook-pixel' );
    if ( in_array( $handle, $defer_scripts ) ) {
        return str_replace( ' src', ' defer src', $tag );
    }
    return $tag;
}, 10, 3 );

Advanced Techniques: HTTP/2, Prefetch, and WP-CLI

Once you have applied the fundamentals, advanced techniques can squeeze further improvements from your server configuration and WordPress setup.

Enable HTTP/2 on Your Server

HTTP/2 supports multiplexing, meaning multiple requests can travel over a single TCP connection simultaneously. This fundamentally changes the economics of HTTP requests — many smaller files become less costly. Most modern hosts (SiteGround, Kinsta, WP Engine, Cloudflare) enable HTTP/2 by default. Verify HTTP/2 is active using the HTTP/2 and SPDY indicator Chrome extension or by checking your host's dashboard.

Use Resource Hints for Critical Requests

Resource hints (dns-prefetch, preconnect, prefetch, preload) instruct the browser to prepare connections or fetch resources early, reducing the perceived load time of critical requests:

// Add preconnect for Google Fonts
add_action( 'wp_head', function() {
    echo '<link rel="preconnect" href="https://fonts.googleapis.com">';
    echo '<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>';
}, 1 );

Audit Enqueued Assets with WP-CLI

Use WP-CLI to quickly list all registered scripts and styles from the command line, making it easier to identify candidates for removal:

wp eval 'global $wp_scripts; print_r( array_keys( $wp_scripts->registered ) );'

This command outputs every registered script handle, which you can cross-reference with your Network tab audit to find and dequeue redundant assets.

Inline Critical CSS

Inlining critical above-the-fold CSS directly into the <head> of your HTML eliminates the render-blocking request for your main stylesheet on first paint. Tools like Critical (Node.js) or the WP Rocket critical CSS feature can automate this. Load the full stylesheet asynchronously after the page renders to avoid blocking rendering while still delivering complete styles.

Frequently Asked Questions

How many HTTP requests is too many for a WordPress site?

There is no universal limit, but best practice is to aim for fewer than 50 HTTP requests per page. Pages with fewer than 30 requests are considered well-optimised. Use GTmetrix or Chrome DevTools to audit your current count and prioritise reducing the largest sources first.

Will combining CSS and JavaScript files break my WordPress site?

It can in some cases, particularly when scripts rely on a specific load order or when inline scripts depend on a handle that has been combined. Always test file combination on a staging site first, and use the exclusion options in your caching plugin to prevent problem scripts from being combined.

Does HTTP/2 make reducing HTTP requests unnecessary?

HTTP/2 reduces the penalty for multiple requests through multiplexing, but reducing requests still matters. Each request still has overhead, and fewer requests mean less data transferred, lower server processing, and better performance on mobile connections. HTTP/2 and request reduction are complementary, not mutually exclusive.

How do I reduce HTTP requests without a plugin?

You can manually dequeue scripts and styles in functions.php, inline small CSS and SVG assets, set browser caching headers in .htaccess, host fonts locally, and configure your server to enable HTTP/2. The WP-CLI audit command described in this guide also helps you identify what to remove without installing additional plugins.

Reducing HTTP requests in WordPress is an ongoing process rather than a one-time fix. As your site evolves with new plugins, themes, and content, regularly auditing your asset load keeps performance from degrading. For those who prefer a hands-off approach, WP AI Agent is a powerful tool that lets you manage WordPress performance tasks — including auditing scripts, dequeuing assets, and configuring caching settings — through simple natural-language AI chat, making optimisation accessible to everyone regardless of technical skill.

Ready to manage WordPress with AI?

Get 100,000 tokens free every month. No credit card required.

Get Your Free License Key →

More from the blog