Created
March 19, 2014 10:52
-
-
Save dannyconnolly/9639376 to your computer and use it in GitHub Desktop.
Remove query strings from static resources in wordpress
This file contains hidden or 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
function _remove_script_version( $src ){ | |
$parts = explode( '?ver', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We were using a similar snippet for several years, but it's a bit limited in scope.
If interested, check our free plugin: https://wordpress.org/plugins/remove-query-strings-littlebizzy/
...by default, strings
?=, ?v=, ?ver=, ?version=
are removed.