Skip to content

Instantly share code, notes, and snippets.

@surefirewebserv
Last active December 14, 2015 09:49
Show Gist options
  • Save surefirewebserv/5067222 to your computer and use it in GitHub Desktop.
Save surefirewebserv/5067222 to your computer and use it in GitHub Desktop.
Remove ?ver=xxx from styles and scripts.
<?php
/** Remove ?ver=xxx from styles and scripts */
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', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
@robneu
Copy link

robneu commented Mar 1, 2013

+1 What Pippin said.

@surefirewebserv
Copy link
Author

I agree, and you can also target which file you want to remove the version number, however in my specific situation, the scripts were not being read with the ?ver=xxx attached.

I wouldn't do this on my normal sites...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment