Skip to content

Instantly share code, notes, and snippets.

@gnikolopoulos
Last active August 27, 2015 10:51
Show Gist options
  • Save gnikolopoulos/abc574016622ec68a26f to your computer and use it in GitHub Desktop.
Save gnikolopoulos/abc574016622ec68a26f to your computer and use it in GitHub Desktop.
[Wordpress] Remove query strings from javascript and css files
<?php
function remove_cssjs_querystring( $src ) {
if( strpos( $src, '?rev=' ) ) // copy/paste this line and the next one to take away what you want from the end of your css/js
$src = remove_query_arg( 'rev', $src );
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_querystring', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_querystring', 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment