WordPress adds a generator meta tag to the head element of every page that includes the version of WordPress you are using. Many people have debated the need for this and recommend removing it especially if you haven’t been upgrading WordPress regularly. A crawler can easily scan this info and look for sites that are running an older version of WordPress with a known exploit. You can add the following code to your theme’s function.php file or in a plugin.
Tweak the WordPress Generator Meta Tag
The following code will remove the version number from the meta tag:
function devmnd_tweak_generator( $generator ) {
return str_replace( ' ' . get_bloginfo( 'version' ), '', $generator );
}
add_filter( 'the_generator', 'devmnd_tweak_generator' );
Before: <meta name="generator" content="WordPress 3.0-RC1-15112" />
After: <meta name="generator" content="WordPress" />
You can even add your own custom version number in the generator meta tag:
return str_replace( get_bloginfo( 'version' ), '4.0', $generator );
Remove the WordPress Generator Meta Tag:
if ( function_exists( 'wp_generator' ) ) {
remove_action( 'wp_head', 'wp_generator' );
}