Remove Generator Field From WordPress Meta

Submitted by Kenny on Wed, 06/18/2008 - 13:03

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

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.