Speed tests often flag the ‘leverage browser caching’ warning, making it sound like a complicated technical issue. We fix this error regularly to help websites load faster and rank better in search results.
Browser caching simply tells a user’s computer to store files like images so they don’t need to download them again. This significantly reduces page load times and improves the overall user experience.
You can fix this warning easily without hiring a developer. We will walk you through the beginner-friendly solutions we use to enable browser caching on our own websites.

What Is Browser Caching in WordPress?
Browser caching is a way to improve the loading speed of your WordPress website.
Normally, when a web page loads, all of the files will be loaded separately. This creates multiple requests between the browser and your WordPress hosting server, which increases the web page loading time.
When browser caching is enabled, your web browser stores a copy of your web page locally. This allows browsers to load common files like stylesheets, logos, and images faster when the user visits a second page on your site.

This reduces the overall server load because fewer requests will be made to the actual server, improving performance optimization and user experience as a result.
Where Do You See the ‘Leverage Browser Caching’ Warning?
The ‘Leverage browser caching’ warning means that you don’t have browser caching enabled, or your caching could be set up the wrong way.
When you run a website speed test using a tool like GTmetrix or Google PageSpeed Insights, you will get a report that shows you what you can fix to speed up WordPress.
If your website isn’t currently using browser caching, then you will get a warning to enable browser caching.
Here is what the error looks like in the PageSpeed Insights tool:

Sometimes you will get a warning that says your ‘efficient cache policy’ isn’t working.
Both of these warnings refer to an error with your browser caching setup.

If you see the ‘Leverage browser caching’ warning, then it means you will need to activate and customize the caching rules to speed up your site.
That being said, let’s take a look at how to easily fix the ‘Leverage browser caching’ warning in WordPress using two different methods. Simply use the quick links below to choose the method you wish to use:
- Fix 'Leverage Browser Caching' Warning With WP Rocket
- Fix 'Leverage Browser Caching' Warning Using Code
- FAQs About Leveraging Browser Caching
- Additional Resources
Method 1: Fix ‘Leverage Browser Caching’ Warning With WP Rocket
WP Rocket is the best WordPress caching plugin on the market. It’s beginner-friendly and can help you optimize your site for speed, all without knowing complex caching and speed terms.

Right out of the box, all the recommended caching settings will really speed up your WordPress blog.
To fix the ‘Leverage browser caching’ warning with WP Rocket, all you have to do is install and activate the plugin.
That’s it.
For more details, you can see our guide on how to properly install and set up WP Rocket in WordPress.
WP Rocket will automatically enable browser caching and modify your .htaccess file with the right rules.
Note: If you are using SiteGround web hosting, then you can use the free SiteGround Optimizer plugin instead. It has nearly the same features as WP Rocket, and it will automatically enable browser caching for you.
Method 2: Fix ‘Leverage Browser Caching’ Warning Using Code
The second method involves adding code to your WordPress files. If you haven’t done this before, then see our beginner’s guide to pasting snippets from the web into WordPress.
This method is not as beginner-friendly, so please only follow this if you know exactly what you’re doing. For most business owners, we recommend using Method 1.
With that said, let’s take a look at how to fix the ‘Leverage browser caching’ warning by adding code to WordPress.
Note: Before you customize your WordPress code, we recommend backing up your WordPress site. For more details, see our guide on how to back up and restore your WordPress site.
Determine Whether Your Website is Running Apache or Nginx
First, you need to figure out if your website is using Apache or Nginx servers.
To do this, open up your website in a new tab or window. Then, right-click and select the ‘Inspect’ option.

Next, click the ‘Network’ tab at the top of the page.
You may need to refresh the page for the results to load.

After that, click your domain name in the ‘Name’ column.
It should be at the top of the page.

Then, in the ‘Response Headers’ section, you’ll see an item called ‘server’ where the type of server is displayed.
In this case, the site is running on an Apache server.

Add Cache-Control and Expires Headers in Apache
To fix the ‘Leverage browser caching’ warning with an Apache server, you are going to be adding code to your .htaccess file.
To edit this file, you need to connect to your WordPress hosting account with an FTP client or your host’s file manager tool.
After you are connected, you can see your .htaccess file in your website’s root folder.

If you can’t find it, then don’t worry. Sometimes this file can be hidden. For more details, see our guide on why you can’t find the .htaccess file on your WordPress site.
Next, you need to add code that turns on browser caching. This tells the web browser how long it should store your website resources before they are deleted.
- The cache-control header gives specific details to the web browser about how caching should be done.
- The expires header enables caching and tells the web browser how long it should store specific files before being deleted.
You simply need to add the following code to your .htaccess file:
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 3 days"
</IfModule>
## EXPIRES HEADER CACHING ##
This code sets different cache expiration dates based on the type of file.
Don’t forget to save the file after you edit it. After that, the web browser will request new versions of the files.
Add Cache-Control and Expires Headers in Nginx
If you are using an Nginx web server to host your WordPress site, then you can edit the server configuration file to fix the browser caching error.
However, if you are using a Managed WordPress Hosting provider like WP Engine or SiteGround, you usually won’t have permission to edit this file. In that case, you should contact your hosting support team and ask them to enable browser caching for you.
If you manage your own VPS or dedicated server, you can add the following code to your configuration file:
location ~* \.(jpg|jpeg|gif|png|svg)$ {
expires 365d;
add_header Cache-Control "public, no-transform";
}
location ~* \.(pdf|css|html|js|swf)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
This code sets the expiration times for the different file types. Notice that images are cached for one year (365d) because they usually stay the same, whereas CSS and JS files are cached for 30 days.
If you are looking to speed up WordPress even more, then make sure to check out our guide on how to boost WordPress speed and performance.
FAQs About Leveraging Browser Caching
Here are some of the most common questions about fixing the leverage browser caching warning in WordPress. These answers will help you better understand browser caching and troubleshoot any issues you might encounter.
1. What does the ‘leverage browser caching’ warning mean?
The ‘leverage browser caching’ warning appears because your website is not saving files in the user’s browser for future use. When a user visits a second page on your site, their browser has to download every single image and script again, which slows down your page load speed.
This warning shows up in speed testing tools like Google PageSpeed Insights and GTmetrix when your site could be loading faster by enabling browser caching. Essentially, it means you’re missing out on a simple way to improve your site’s performance.
2. How long should I set browser cache expiration times?
For most WordPress sites, we recommend setting images to expire after 1 year, CSS and JavaScript files after 1 month, and other static files after 3-7 days. Images rarely change, so they can be cached longer, while CSS and JS files might be updated more frequently. You can always adjust these times based on how often you update your site’s content and design.
3. Will enabling browser caching break my website?
No, enabling browser caching will not break your website. Browser caching only affects how files are stored in visitors’ browsers and doesn’t change your actual website files. However, we always recommend creating a backup before making any changes to your site, especially when editing code or .htaccess files manually.
4. Do I need a caching plugin if my hosting provider offers caching?
While many hosting providers offer basic caching features, a dedicated caching plugin like WP Rocket typically provides more comprehensive optimization options. Host-level caching often focuses on server-side caching, while plugins like WP Rocket handle browser caching, file compression, and other performance features. You can use both together for maximum speed benefits.
5. Why am I still seeing the warning after enabling browser caching?
If you’re still seeing the leverage browser caching warning after enabling it, there could be a few reasons: your cache settings might not be configured correctly, your CDN could be overriding the settings, or the testing tool might be checking cached results. Try clearing your site’s cache, waiting 24-48 hours for changes to propagate, and then running the speed test again.
6. Can browser caching cause problems with website updates?
Browser caching can occasionally cause visitors to see outdated versions of your site after you make updates. This happens because their browser is loading the cached version instead of the new files. Most caching plugins handle this automatically by clearing the cache when you update your site. If needed, you can also tell visitors to clear their browser cache or use hard refresh (Ctrl+F5) to see the latest version.
Additional Resources
We hope this article helped you learn how to easily fix the ‘Leverage browser caching’ warning in WordPress. You may also want to see these other guides on how to improve your website performance:
- The Ultimate Guide to Boost WordPress Speed & Performance
- Best WordPress Caching Plugins to Speed Up Your Website
- How to Properly Run a Website Speed Test (Best Tools)
- How to Optimize Images for Web Performance Without Losing Quality
- Fastest WordPress Hosting (Performance Tests)
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Have a question or suggestion? Please leave a comment to start the discussion.