Skip to content

Instantly share code, notes, and snippets.

@weszty
Forked from schilke/functions.php
Created February 24, 2023 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weszty/98fa6db86932e8458ea9968c2c358b5e to your computer and use it in GitHub Desktop.
Save weszty/98fa6db86932e8458ea9968c2c358b5e 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