Remove WP version from Wp-admin pages
-
Hi,
An external company has done a security audit on our web sites and I now have a Low risk item to resolve – remove WP version number from wp-admin pages (ver=4.8).
For example, the following code is part of the wp-login.php head:
<script type='text/javascript' src='https://www.domain.com/wp/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate&ver=4.8'></script>
<link rel='stylesheet' type='text/css' media='all' />
I am using the following code in my functions.php
// remove wp version param from any enqueued scripts
// @ref https://www.virendrachandak.com/techtalk/how-to-remove-wordpress-version-parameter-from-js-and-css-files/
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );// Remove WordPress generator version
remove_action( 'wp_head', 'wp_generator' );
add_filter( 'the_generator', '__return_false' );
I have also tried the following plugins:
- Meta Generator and Version Info Remover
- Remove Query Strings From Static Resources
- Remove Version
- Remove Version Info
- Remove WP version everywhere
- WP Version in Query String Modifier
And I’ve tried disabling all plugins and reverting to the Twenty Seventeen theme (with the above remove WP code).
Does anyone have a solution for removing the ver=4.8 from CSS and JS files in wp-admin?
Thank you
Chris.
- The topic ‘Remove WP version from Wp-admin pages’ is closed to new replies.