In this article, we will learn how to fix leverage browser caching warnings in WordPress to improve/speed up your WordPress site and deliver a superior experience to your visitors.
First of all, we need to know what is browser caching in WordPress. So it is basically a way to improve your website loading speeds by creating multiple requests between the browser and your WordPress hosting server.
Actually, browser cache stores a copy of your webpages locally and allow the browsers to load common files faster when the user visits your webpage a second time.
You will receive a browser caching warning when you don’t have browser caching enabled and you have set up your caching in the wrong way.
We can fix leverage browser caching warnings in two ways.
- By adding a WordPress Plugin
- By adding the code manually
Here we are using the Leverage Browser Caching plugin which is the best and user friendly for beginners.
By adding a WordPress Plugin
- Login into your wordpress dashboard and go to Plugins.

2. Click “Add New“, search for “Leverage Browser Caching” and click on Install Now button.

3. Click “Activate” to activate the plugin.

4. After activating the plugin, check your website again and you will find that warning has been fixed.
By adding the code manually
- Login to your control panel. Here I am taking DirectAdmin panel. After login, scroll down and click on “File Manager” icon.

2. Navigate to the domain and double-click on it. Select your domain name(if you are having multiple domains) then double-click on the public_html folder.

3. Here, you will find the .htaccess file. Right-click on this file and click Edit.

4. Copy and paste the following lines of codes into it at the bottom.
#Customize expires caching start - adjust the period according to your needs
<IfModule mod_expires.c>
FileETag MTime Size
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
ExpiresActive On
ExpiresByType text/html "access 600 seconds"
ExpiresByType application/xhtml+xml "access 600 seconds"
ExpiresByType text/css "access 1 month"
ExpiresByType text/javascript "access 1 month"
ExpiresByType text/x-javascript "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 application/pdf "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
#Expires caching end