Created
January 22, 2017 13:57
-
-
Save joviczarko/db53595301f4a748b83139e7456663b6 to your computer and use it in GitHub Desktop.
Remove Query String from Static Resources .js/?ver=1.2
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
/* Remove Query String from Static Resources */ | |
/* Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources: */ | |
function remove_cssjs_ver( $src ) { | |
if( strpos( $src, '?ver=' ) ) | |
$src = remove_query_arg( 'ver', $src ); | |
return $src; | |
} | |
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 ); | |
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment