0

I need to understand the correct way to use cache busting, because i know that i can use a query string for version which changes in every file update, but i prefer to use cache busting through changing file name, so i created program to generate a new file with a new numbered name on every update and it works perfect but the problem is that i have to clear the cache of a caching plugin, So is this the normal way to use cache busting or it should be working another way automatically?

4

The main obvious problem with your scheme is that when someone wil try to reload an old page it will get all kinds of 404 when requesting the JS and CSS since those files are not on the server anymore.

There is seriously no need to reinvent the wheel, just follow WordPress's best practice unless you have an excellent reason to deviate.

  • Thank you that is important foresure but what if I want to continue..then what is the best practice? – Mohamed Omar Aug 9 '17 at 7:56
  • Just increment the version number given in wp_enqueue_scripts whenever you change the file. – Jacob Peattie Aug 9 '17 at 8:54
  • I know but what i need to understand is that if i followed the other named file technique then i should purge the cache on every update or what? – Mohamed Omar Aug 9 '17 at 9:15
  • sorry @MohamedOmar, but right now I fail to see the point of your latest comment. If you are doing something wrong, you should stop doing it. How to better integrate your wrong way with some plugin you will have to ask the plugin's author – Mark Kaplun Aug 9 '17 at 9:22
  • this is not like the wordpress "best practice" can not be improved upon, but it is a baseline which you should expect all plugins and themes to respect – Mark Kaplun Aug 9 '17 at 9:24

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.