Remove versioning from WordPress CSS files

When working on a site there isn’t much more infuriating when the theme you’re working with insists on loading versioned CSS files which are out of date. They look like this:


As you may know, clearing cache will not solve this. There doesn’t seem to be any solution other than waiting for an unknown and unspecified amount of time. Depending on what the suffix is this could mean waiting an hour, a day, or until the next version of WordPress!

Luckily Sam Thornton over at codementor has a nifty function which solves this:

// Remove WP Version From Styles
add_filter( ‘style_loader_src’, ‘sdt_remove_ver_css_js’, 9999 );
// Remove WP Version From Scripts
add_filter( ‘script_loader_src’, ‘sdt_remove_ver_css_js’, 9999 );

// Function to remove version numbers
function sdt_remove_ver_css_js( $src ) {
if ( strpos( $src, ‘ver=’ ) )
$src = remove_query_arg( ‘ver’, $src );
return $src;

Put this in functions.php and hey presto problem solved. Note that nothing will be versioned which will probably slow your site down quite a bit.