stop removing version
-
I have a file (custom.js) which I enqueue with a version number made from the file timestamp. It normally looks like this:
<script src='https://coherencecollaborative.com/cc/wp-content/themes/insite-starter/inc/assets/js/custom.js?ver=1623097470' id='insite-starter-custom-js-js' data-script-handle='insite-starter-custom-js'></script>
The version number normally forces browsers to refresh that file whenever (but only) when the file is changed.WP Optimize seems to be stripping out the version number all together.
I’ve excluded that file from minification like this:
*/wp-content/themes/insite-starter/inc/assets/js/custom.js*
(I’ve tried with and without the trailing asterisk.)But the timestamp version number still gets stripped out.
I do the same thing with the theme’s main CSS file. I’ve excluded that file too, and the version number is not stripped from the css file:
<link rel='stylesheet' id='insite-starter-style-css' href='https://coherencecollaborative.com/cc/wp-content/themes/insite-starter/style.css?ver=1624646169' media='all' />
(The website is installed in a sub-directory ( /cc/ ) but displayed in the root. That’s why I’m using the leading asterisk in those exclusion rules.)
Is there any way to stop WP Optimize from stripping that version number from the js file? Am I doing something wrong?
If it is not possible to keep the timestamp/version number, and I still want to be sure that the file is not cached after it has been edited, am I better off not excluding the file, and (manually?) clearing the minify cache whenever I edit it?
Any advice appreciated! Thanks.
The page I need help with: [log in to see the link]
- The topic ‘stop removing version’ is closed to new replies.