Skip to content

Instantly share code, notes, and snippets.

@michaelwilhelmsen
Created September 11, 2014 12:56
Show Gist options
  • Select an option

  • Save michaelwilhelmsen/2bc3b5787256a6b01751 to your computer and use it in GitHub Desktop.

Select an option

Save michaelwilhelmsen/2bc3b5787256a6b01751 to your computer and use it in GitHub Desktop.
Remove Query Strings to Optimize Page Speed. Put in functions.php
// Remove Query Strings to Optimize Page Speed
function _remove_query_strings_1( $src ){
$rqs = explode( '?ver', $src );
return $rqs[0];
}
function _remove_query_strings_2( $src ){
$rqs = explode( '&ver', $src );
return $rqs[0];
}
add_filter( 'script_loader_src', '_remove_query_strings_1', 15, 1 );
add_filter( 'style_loader_src', '_remove_query_strings_1', 15, 1 );
add_filter( 'script_loader_src', '_remove_query_strings_2', 15, 1 );
add_filter( 'style_loader_src', '_remove_query_strings_2', 15, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment