When i change the css and js files in my wordpress templates and visit my website, the website is still loading the old css and js files from the browser cache. How can i tell the website that if my cache is older than a specific date, it should load the new template files?


If you're using a cache plugin on your WordPress platform, you should clear the plugin's cache, so it clears and caches a new version of these files. (there should be an option to set an expiring date to it also, depending on the plugin.)


You can use query strings in order to force the browser's new file update.

Query string example: ?v=2045

Here's an example on a <link> tag:

<link rel="stylesheet" type="text/css" href="theme.css?v=1">

If you wish for this file to be updated only on your side, you can do a CTRL+F5 browser refresh, and a new cache request will be made.

  1. You can disable any cache plugin used in the website .
  2. Clear your browser cache
  3. Add expiration tag for css and javascript files in.htaccess file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.