I’m stuck with old versions of CSS, JS…etc even though I deleted the cache.
What steps have you taken to resolve the issue?
As I found out, the solution to the problem is to exclude the CSS and JS files of my Worpdress themes and plugins from Cloudflare Cache. Even though I have cleared Cloudflare Cache, my site is showing the Style.css file that was updated 1 week ago. I don’t know how to do this.
Let me explain the problem in more detail; Users who have visited the site before remain in the immediate state they visited, then when they visit the site again, they cannot get up-to-date CSS and JS files. For example, the user who visited the site 10 days ago saw the v1.0 style.css file, 5 days later, with an update, the file becomes v1.1, the user still continues to see v1.0, the new user who comes at the same time can see the new file, when v1.2 is uploaded when 5 more days pass, the 1st user remains in v1.0 and the 2nd user remains in v1.1 and so on.
This is likely to be the root cause of this behaviour. Try disabling caching in LiteSpeed and disabling local caching in Wordpress (so that assets are not returned from /wp-content/cache/), then purge cache everywhere and check if this is fixed.
If this doesn’t resolve the problem, confirm if the affected browser is requesting the old version using an outdated ?ver= number or new version using the new ?ver= number when this happens using DevTools. If the browser is requesting a new version but is getting served stale asset instead, you need ensure each ?ver= is cached as a separate asset using Cache Rules.
Thanks a lot for the answer, it has enlightened me on the way to this solution.
I was actually giving the version number to CSS and JS files, but I realized that there was a function in the child theme that prevented this, taking over the main function that caused Wordpress to be littered with the version number. Fixing this solved my problem.
Maybe it will help someone else who comes across this thread, I’ll note here what I did;
Faulty code;
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style('theme', get_template_directory_uri() . '/style.css' );
wp_enqueue_style('theme-child', get_stylesheet_directory_uri() . '/style.css', array('td-theme') );
}```
The code I fixed;
function theme_enqueue_styles() {
$parent_style = ‘laura-style’; // Main theme style handle
$child_style_css_version = ‘1.0’;
About codes:I preferred to use variables for ease of use, it would have been fine without them. Also in the new code it was important that the child theme's style.css file was loaded later, for this I added a feature that waits for the parent theme style.css file.
The second part was not necessary. Right now everything works fine even when I just delete the cache from WP Rocket. I don't need to delete from WPX and Cloudflare, they all communicate with each other.
Thank you once again for the answer.