Remove Javascript and CSS versioning from WordPress

While trying to optimize my site a while back I came across some issues with Javascript and CSS versions causing caching issues, or rather not being cached. This lack of caching of the Javascript and CSS files was lowering the site score on many testing sites including WebPageTest.

I searched around a bit and came across the following code snippet which will remove most, if not all of the versioning from Javascript and CSS files on your WordPress site.

To enable this you will need add the following code to your themes function.

//* Remove JS/CSS versions
function remove_cssjs_ver( $src ) {
	if( strpos( $src, '?ver=' ) )
		$src = remove_query_arg( 'ver', $src );
	return $src;
add_filter( 'style_loader_src', 'remove_cssjs_ver', 1000 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 1000 );

If you are using a caching plugin such as WP-Super Cache/W3 Total Cache you will need to of course clear your cache before these changes will be shown