Last active
August 27, 2015 10:51
-
-
Save gnikolopoulos/abc574016622ec68a26f to your computer and use it in GitHub Desktop.
[Wordpress] Remove query strings from javascript and css files
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 | |
function remove_cssjs_querystring( $src ) { | |
if( strpos( $src, '?rev=' ) ) // copy/paste this line and the next one to take away what you want from the end of your css/js | |
$src = remove_query_arg( 'rev', $src ); | |
if( strpos( $src, '?ver=' ) ) | |
$src = remove_query_arg( 'ver', $src ); | |
return $src; | |
} | |
add_filter( 'style_loader_src', 'remove_cssjs_querystring', 10, 2 ); | |
add_filter( 'script_loader_src', 'remove_cssjs_querystring', 10, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment