style.css?ver=6.4) are how WordPress busts browser and CDN caches when a theme or plugin updates a file — but some caching/CDN layers and page-speed testing tools flag them as a performance issue, since certain proxies won’t cache a URL that includes a query string.
Option 1 — A Caching Plugin Setting
If you’re already running a caching plugin (LiteSpeed Cache, WP Rocket, and others), check its optimization settings first — most include a one-click “Remove query strings from static resources” toggle that handles this without touching any code.Option 2 — A Small Code Snippet
If you’d rather not rely on a plugin setting, this snippet in your child theme’sfunctions.php strips the ver parameter from enqueued styles and scripts:
function tgh_remove_query_strings($src) {
if (strpos($src, 'ver=')) {
$src = remove_query_arg('ver', $src);
}
return $src;
}
add_filter('style_loader_src', 'tgh_remove_query_strings', 10, 1);
add_filter('script_loader_src', 'tgh_remove_query_strings', 10, 1);
Note that removing the version query string also removes its cache-busting function — if you (or a plugin) update a CSS/JS file, visitors’ browsers may keep serving a stale cached copy until their local cache naturally expires, so weigh the modest speed-test score improvement against that trade-off.
Resources
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.
A great plugin that work perfectly. I reduced the load time to 2sec from 5sec
Due to the use of this plugin my websites speed increased amazingly. https://t.co/h04rH35zXC
Due to the use of this plugin my websites speed increased amazingly. https://t.co/h04rH35zXC
A great plugin that work perfectly. I reduced the load time to 2sec from 5sec
A great plugin that work perfectly. I reduced the load time to 2sec from 5sec