Last active
February 24, 2023 13:41
-
-
Save schilke/e9ad4b1d5fec5ce902fd to your computer and use it in GitHub Desktop.
Remove query strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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