Remove Generator Field From WordPress Meta

WordPress automagically interjects meta content specifying that the generator of the webpage is WordPress and, specifically, what version it is. Like this:

<meta name="generator" content="WordPress 2.5.1" />

If you want to remove that, there's an easy way to do it. If you don't already have a functions.php file in your theme, create one. Make sure that it starts with <?php and ends with ?> and has NOTHING outside those tags or it will cause your theme to yak.

Now add the following line to your functions.php file:

remove_action('wp_head', 'wp_generator');

And that should do it! Now you can go through all your plugins and remove the comments and other garbage they interject in order to try to hide the fact that you're running WordPress.

Edit: As Jerry pointed out in the comments, you could still see the generator meta in the RSS feed. I found a solution to this at Bioneural.net.

Simply add this code to your theme's functions.php file.

// Remove WP version info
function hide_wp_vers()
{
    return '';
} // end hide_wp_vers function

add_filter('the_generator','hide_wp_vers');
Category: 

Comments

And how do you remove the tag from your feed? I can see what version of WP you're running by looking at that.

Great point, Jerry. I'm glad you caught that. Thanks to a little bit of Googling and some great work from Bruce at Bioneural.net, we have a solution! See the post for my addendum.

Works great! Thank you very much for looking into it and posting a solution so quickly.

Thanks for this especially adding the part that removes generator metaname from Feeds.

I get this after adding to my functions.php file:

Fatal error: Call to undefined function remove_action() in /pathto/wp-includes/functions.php on line 25

Just use this code and paste it into your function.php:

/* Remove WordPress generator meta tag */

function rmv_generator_filter() {

return ''; }

add_filter('the_generator', 'rmv_generator_filter');

Add new comment

You can optionally provide your email address, which will remain private, if you wish to be contacted directly about this comment.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.