How to Remove WordPress Version Number

By default WordPress automatically outputs the current WordPress version number into the “<head>” section of your website.But If you are looking to harden your WordPress site then you should consider removing publicly displayed version number of WordPress you’re currently running.

If you are running the latest version of WordPress then your site may be secure but If you havent updated your WordPress for some time then the hacker can get some good information on where to start, by using the known vulnerabilities in that WordPress version hacker can easily target your site.

Note : Even though you remove the WordPress version, the hacker can use some other techniques to identify the version.So it’s always recommended to keep your WordPress installation up to date.

Read :  Top Things to Consider When Changing WordPress Themes

By default, WordPress executes wp_generator() function whenever the wp_head() hook is called.As a result of this WordPress adds the following meta tag to the head section of your WordPress site:

<metaname="generator"content="WordPress 3.5.1"/>

But now WordPress itself will automatically add the WordPress version number to your WordPress site’s In this post I will show you the ways on how to remove above WordPress Version number information.

How to Remove WordPress Version Number Meta

Wrong way to remove WordPress Version Number One method to remove WordPress version information is to add the following line of code to the functions.php file of your theme.

remove_action('wp_head', 'wp_generator');

However this solution is not PERFECT .The above line of code will only remove the WordPress version number from your head area but the hacker can get the Version Information from Rss Feeds.

Wrong way to remove WordPress Version NumberOld Method of removing Version number is to open your WordPress Theme’s header.php file and remove below line of code:

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />;

Previously WordPress relied on WordPress theme to get WordPress version, But now WordPress itself automatically add’s the WordPress version number to your WordPress site’s <head>. So this method of removing WordPress version number doesn’t work on latest version of WordPress.

Right Way to remove WordPress Version Number

Best way to completely remove traces of WordPress version number is by calling the following function from your functions.php file:

function bh_remove_version_info() {
return '';
}
add_filter('the_generator', 'bh_remove_version_info');

By using this method  you will be able to remove the WordPress version number not only from your WordPress theme files but also from WordPress site RSS & Atom feed’s.

If you don’t want to mess up your WordPress code then read this tutorial on How to Remove WordPress Version Number with Plugins

Liked this WordPress tutorial? Then why not comeback to read our other tutorials on WordPress.You can even stay updated by following us on twitter or by liking on Facebook.