Skip to content

Instantly share code, notes, and snippets.

@schilke
Last active February 24, 2023 13:41
Show Gist options
  • Save schilke/e9ad4b1d5fec5ce902fd to your computer and use it in GitHub Desktop.
Save schilke/e9ad4b1d5fec5ce902fd to your computer and use it in GitHub Desktop.
Remove query strings
<?php
// don't copy above line when copying and pasting into your functions.php
// Remove WP version number from js and css files.
// more exact function, removes also "&"
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) || strpos( $src, '&ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 15, 1 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 15, 1 );
// don't copy below line when copying and pasting into your functions.php
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment