Hi,
I have created a block called quote, and in the backend it calls the CSS like this:
https://example.com/wp-content/themes/theme-name/blocks/quote/quote.css?ver=6.4.2
The 6.4.2 is the current WordPress version.
But this causes issues because I want to update the file, but the file is now cached in browsers. How can I force this to change the version number?
Thanks
Shaun
If you are using block metadata as described here then you will need to alter the url string the version https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/ using a filter on this hook https://developer.wordpress.org/reference/hooks/style_loader_src/ this page has an example of removing the version https://wpadminify.com/kb/how-to-remove-version-from-style-and-script-from-page-source/.
If you are calling call wp_enqueue_style() directly then you can supply a version values.
You’ll also need to version your css file and change the version number every time you update it.