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.

<?php
function remove_wp_version() { return; }
   add_filter('the_generator','remove_wp_version');
?>

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.

Today In History

  •  
  •  

Comment

Leave a Reply

Note: Convet HTML, PHP, JavaScripts from Postable, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.