Fix the Leverage Browser Caching Warning in WordPress and WooCommerce Website

Do you want to easily fix the browser caching warning on your WordPress Website? and want to improve your WordPress website performance?

By fixing the leverage browser caching warning, you will rapidly improve your WordPress website performance and extend a better experience for your website visitors.

Fixing the Leverage Browser Caching Warning is one of the best ways to improve the WordPress website speed. You can fix this warning in very easy ways. You can fix it using the caching plugins or adding code snippets in your .htaccess file.

Increasing WordPress website performance is a major important matter. Because enough WordPress website performance quality is unsatisfactory. If you have run a slow-loading website you will lose visitors and revenue.

However, in this guide, I will show you how to easily fix the Leverage Browser Caching Warning In WordPress websites. Leverage Browser Caching Warning issues are one kind of the major problems for WordPress website performance.

Leverage Browser Caching obstructs the WordPress website performance. Not only WordPress websites Leverage Browser Caching can prevent any kind of website eg, HTML or PHP website.

if you have ever run your WordPress website through GTMetrix or PageSpeed Insights then you have probably seen that big yellow Leverage Browser Caching warning.

So, I am going to start with what this warning means, and how it influences you, I will an introduction to the Leverage Browser Caching warning. Then I will point out several tips for Leverage Browser Caching Warning.

What is the Leverage Browser Caching

Leverage Browser Caching means accumulating static files of a website in a visitor browser. Such as images, JavaScript, CSS, or HTML. And then retrieving them from the browser quickly instead of again from the server.

At any moment a browser loads a webpage and downloads all the web files to properly display the page like the HTML, CSS, JavaScript, and images. A few pages might only consist of some files and be small in size or can be kilobytes. For another however there may be a lot of files, and these may add up to be a couple of megabytes huge. Like, for example, is 5 MB+.

Leverage Browser Caching Warning in WordPress

How to Leverage Browser Caching with Your Server

There are many ways to leverage browser caching on the webserver. The approach you choose will mainly depend on which web server you’re using (Nginx Or Apache). You may also attend your website speed test that certain assets show an “Expiration not specified” warning while others show an actual time value ( 5 minutes). Look like the following image.

How to Leverage Browser Caching with Your Server

In the example raised, That means that your web server does not have any browser caching rules construe for .png files and the expiry time is only 5 minutes for .css files.

In the following sections, I would like to how to enable Expires and Cache-Control headers on the Apache Web server and Nginx Web servers.

Cache-Control Headers on Nginx

Add the following code snippet of your server block which is located at /etc/Nginx/site-enabled/default

Copy to Clipboard

Cache-Control Headers On Apache

Add the following code snippet in your .htaccess file.

Copy to Clipboard

Expires Headers On Nginx

Add the following code snippet of your server block which is located at /etc/nginx/site-enabled/default

Copy to Clipboard

Expires Headers On Apache

Add the following code snippet in your .htaccess file.

Copy to Clipboard

Once complete on your origin web server, you can check if everything is working as normal by opening up Browser Dev Tools or Chrome Dev Tools, operate to the Network tab, and click on an asset.  You shall now see either the Cache-Control, Expires, or both HTTP Response headers.

HTTP Response headers

if you follow the above suggestion, the Leverage Browser Caching Warning problem will be solved.

Fix Google Analytics Leverage Browser Caching Warning in WordPress

The most common leverage browser caching warning issue comes from Google’s own script e.g Google Analytics. The issue is that set a low 2 hour cache time see in the screenshot below.


There is an excellent free plugin available on WordPress for Complete optimize GA(Google Analytics script) this plugin was developed by Daan van den Bergh which grants you to host Google Analytics locally on your WordPress website. This plugin name is CAOS | Host Google Analytics Locally

The plugin is available on the WordPress Plugin directory so you should download this plugin for your website. The plugin grants you to host your GA JavaScript file e.g analytics.js locally and keep it updated using WordPress wp_cron() function.

Further benefits to hosting your Google Analytics script locally are that you reduce your external HTTP requests to Google from 2 down to 1 and you now have full authority over the caching of the file.

Host Google Analytics Locally

So, Just install the plugin and enter Google Analytics Tracking-ID and the plugin adds the needed Tracking Code for Google Analytics to the website header or footer.

If you want to use a plugin to remove the Leverage Browser Caching Warning in WordPress, I would like to recommend this plugin for you. Leverage Browser Caching – WordPress plugin, You do not need to set up this plugin, just need to instill and be active.

Fix Leverage Browser Caching Warning with Caching Plugins

I am going to make another paragraph because I would like to suggest to you the best WordPress caching plugins, These plugins will help you to fix Leverage Browser Caching Warning in your website.

If want to use a caching plugin. Caching plugin already has included browser caching settings. Just your need to activate options from the plugin settings.

Let’s now survey a few popular WordPress caching plugins.

Finally, In this short guide, I covered the popular caching plugins you might want to fix to Leverage Browser Caching Warning in WordPress. So, Let’s Enjoy it!


I hope this guide will help to fix WordPress Leverage Browser Caching Warning and Google Analytics Warning. if you have any questions, please feel free to comment. If your website slows yet, You can check my other article for the Speed up WordPress website.

Our Services

WordPress Website Development Services

If you want to create a WordPress website/WooCommerce website, Kindly visit our services:
  • Professional & Responsive WordPress Website
  • eCommerce Website With WooCommerce
  • Speed Up WordPress Website
  • WordPress Website Security
  • WordPress SEO
Our Services