How to remove WP version in front end?

WordPress version is displayed in meta generator tag, but also in css and js scripts loading (i.e. ..jquery.js?ver=5.5.1). How can I hide it?

Add this code to your functions file:

remove_action ('wp_head', 'wp_generator');
function weext_remove_wp_generator () {return ''; }
add_filter ('the_generator', 'weext_remove_wp_generator');
function weext_remove_css_js_version( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
add_filter( 'style_loader_src', 'weext_remove_css_js_version', 9999 );
add_filter( 'script_loader_src', 'weext_remove_css_js_version', 9999 );

Submit a Comment

Your email address will not be published.