Skip to content

Instantly share code, notes, and snippets.

@grayayer
Created May 11, 2017 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grayayer/4bd0ce48286969303cb6623c8c654cda to your computer and use it in GitHub Desktop.
Save grayayer/4bd0ce48286969303cb6623c8c654cda to your computer and use it in GitHub Desktop.
hide WP version from scripts and styles
/* 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');
@grayayer
Copy link
Author

grayayer commented May 11, 2017

put this in your theme functions.php file or a functionality plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment