How to Remove WordPress Generator Meta Tag

If you take a look at the generated html source code of your WordPress site, chances are there that you would find default WordPress Generator meta tag right before </head> tag. It would look something like the meta tag mentioned below.

<meta name="generator" content="WordPress xxxx">

Generally this piece of meta tag is harmless. However, if a hacker targets your website for any reason this meta tag could cause a great deal of damage for you. Since, the the value of this meta tag indicates the version number of WP you are currently using on your site, it could give lot more information away to the hacker. Perhaps you may not be aware of the security holes that your WP version has but don't treat hackers as dumb as you are.

Bottom line is, it is the best practice for all WP site owners to hide this meta tag. This is how you can do that.

function remove_wp_version() { return; }

Simply place the above snippet code on your theme's functions.php file and save it. This should remove the WordPress Generator meta tag from your source code.

However, there are even easier solutions are out there as well. Instead of writing any function, we simply use the remove_action function like this.

<?php remove_action('wp_head','wp_generator'); ?>

Just like before, copy and paste this on your current theme's functions.php page and update it. That's all.


Commenting is disabled.