Created
May 11, 2017 18:37
-
-
Save grayayer/4bd0ce48286969303cb6623c8c654cda to your computer and use it in GitHub Desktop.
hide WP version from scripts and styles
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
/* Hide WP version strings from scripts and styles | |
* @return {string} $src | |
* @filter script_loader_src | |
* @filter style_loader_src | |
*/ | |
function fjarrett_remove_wp_version_strings( $src ) { | |
global $wp_version; | |
parse_str(parse_url($src, PHP_URL_QUERY), $query); | |
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) { | |
$src = remove_query_arg('ver', $src); | |
} | |
return $src; | |
} | |
add_filter( 'script_loader_src', 'fjarrett_remove_wp_version_strings' ); | |
add_filter( 'style_loader_src', 'fjarrett_remove_wp_version_strings' ); | |
/* Hide WP version strings from generator meta tag */ | |
function wpmudev_remove_version() { | |
return ''; | |
} | |
add_filter('the_generator', 'wpmudev_remove_version'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put this in your theme functions.php file or a functionality plugin