Skip to content

Instantly share code, notes, and snippets.

@dennisblume
Created February 21, 2016 11:53
Show Gist options
  • Save dennisblume/7f54a63d2a02f77605d5 to your computer and use it in GitHub Desktop.
Save dennisblume/7f54a63d2a02f77605d5 to your computer and use it in GitHub Desktop.
Remove query strings from static WordPress resources
//Remove query strings
function _remove_query_strings( $src ){
$rqs = explode( '?ver', $src );
return $rqs[0];
}
if ( is_admin() ) {
// Remove query strings from static resources disabled in admin
}
else {
add_filter( 'script_loader_src', '_remove_query_strings', 15, 1 );
add_filter( 'style_loader_src', '_remove_query_strings', 15, 1 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment