One of the major factors impacting WordPress site speed is the number of HTTP requests your website makes when loading. Each time a page loads, WordPress requests various files—CSS, JavaScript, images, etc.—and these requests can add up quickly, especially if multiple plugins are adding their own assets on every page. Reducing HTTP requests through selective plugin loading can drastically improve your site’s speed, especially on content-heavy or eCommerce sites. In this guide, we’ll go over exactly how to implement this.
Why Reducing HTTP Requests Matters
Each HTTP request adds time to page load. When you have multiple plugins loading CSS or JavaScript files across your entire site, the load time increases and impacts both user experience and SEO. By selectively loading plugins only where they’re needed, you can reduce unnecessary requests and speed up your pages.
Identify Plugins That Load on Every Page
The first step is to identify which plugins are loading resources across your entire site. Use a performance testing tool like GTmetrix or Pingdom to see which CSS and JavaScript files are being requested. Look specifically for files associated with plugins—common examples include contact forms, sliders, social media plugins, and WooCommerce assets.
Install the Asset CleanUp or Perfmatters Plugin
To control when and where plugins load their assets, you’ll need a plugin that allows for selective loading. Two of the best options are Asset CleanUp and Perfmatters. Both plugins allow you to disable CSS and JavaScript files on pages where they’re not needed.
- Asset CleanUp: A free and premium plugin that allows you to unload CSS and JS files on a page-by-page basis.
- Perfmatters: A premium plugin that offers selective loading as well as other performance optimization options.
Disable Unnecessary Assets on Specific Pages
With either Asset CleanUp or Perfmatters, go to a page where you want to disable certain plugin assets. For example, if you have a contact form plugin, there’s no need to load its CSS and JavaScript on every page—only on the contact page.
- Go to the page editor of the page where you want to unload assets (e.g., your homepage, blog posts, etc.).
- In the Asset CleanUp or Perfmatters settings for that page, look for the list of assets being loaded.
- Disable CSS and JS files for plugins that aren’t needed on that page. For example, disable:
- WooCommerce assets on non-product pages
- Contact form CSS/JS on pages without a form
- Slider plugin assets on pages without sliders
- Save your changes.
By doing this on each page, you can significantly reduce the number of requests and improve page speed.
Disable Plugin Features Globally (If Applicable)
Some plugins, especially complex ones like WooCommerce, load assets across your entire site by default. Asset CleanUp and Perfmatters also allow you to disable these assets globally for better performance. For example, you might want to turn off WooCommerce assets on non-store pages.
- In the plugin settings, locate the Global Options section.
- Disable any assets or features that don’t need to load on every page of your site.
Use Code Snippets for Greater Control (Advanced)
If you’re comfortable with code, you can add custom code snippets to selectively dequeue assets based on specific conditions. Here’s a PHP snippet to prevent WooCommerce styles and scripts from loading on non-shop pages:
Add this code to your functions.php file. It will ensure that WooCommerce assets only load on shop-related pages.
Note: Be cautious when editing your functions.php file, and always create a backup before making changes.
Test Your Site’s Speed Again
After setting up selective loading, test your site’s speed with GTmetrix or Google PageSpeed Insights. You should notice a decrease in the number of HTTP requests, leading to faster load times. For best results, keep checking your site periodically to ensure performance remains optimal.
Reducing HTTP requests by loading plugin assets only when necessary is one of the most effective ways to boost WordPress performance. With plugins like Asset CleanUp or Perfmatters, you can easily control which files load on which pages, ensuring your site loads faster without losing functionality. This method is particularly valuable for sites with heavy plugins or large traffic, and it gives you more control over your website’s speed and user experience.






