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?

1 Answer 1

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.

5
  • Thank you that is important foresure but what if I want to continue..then what is the best practice? Aug 9, 2017 at 7:56
  • Just increment the version number given in wp_enqueue_scripts whenever you change the file. Aug 9, 2017 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? Aug 9, 2017 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 Aug 9, 2017 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 Aug 9, 2017 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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