How to remove <meta name="generator" content="WordPress…" /> from <head> in a WP blog

I met with the following interesting problem today:

Due to specific needs, I needed to remove from the HEAD part of one WordPress blog the following:

<meta name="generator" content="WordPress [version number]" />

The WP theme, in which I was making the changes, was the standard for WP Default Kubrick Theme. The WP version I was using was 2.6.2.

I was searching and searching inside the code of header.php — and did not find anything! Before, in every WP theme, in header.php, usually the following code was present:

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /><!-- leave this for stats -->

Now, I wasn’t able to find it…

I tried also global search inside all of the files of this theme, and again, with total un-success. Finally, I tried the last possible option — Google Seach…

…And have found it! :-)

In short: if you want to hide from the HTML code "<meta name="generator" content="WordPress ..." />, as well as the exact WP version you are using, all you need to do is (in case that you don’t find the code inside header.php — for example, in WP up to version 2.3.3, the code was usually there):

1) Locate and open with a text code editor the file functions.php inside the theme directory — for example, if you are using the Default Theme, the functions.php will be in wp-content/themes/default/functions.php.
2) Add inside it the following code:
remove_action('wp_head', 'wp_generator');
3) Save the file functions.php and upload it back to the server.

That’s it! Automagically, the code, which shows that you are using WordPress, as well as the exact version of it, will disappear from the HTML source! :-)


Comments to “How to remove <meta name="generator" content="WordPress…" /> from <head> in a WP blog”:

  1. Noxx Says:

    Hey mate,

    Thanks for the post :)


  2. DG Says:

    But what about removing metaname generator from the RSS and Atom Feeds too?

  3. wino Says:

    Thanks for the fix!

  4. grace Says:

    Thanks So much for the information. Im startingt to get involved in tweaking my own wordpress theme, and this helps alot. I have broken the theme many times, but for now, this should work nicely.

  5. optimiced | en » Plugin for removing <meta name="generator" content="WordPress…" /> in WordPress blogs Says:

    […] while ago I wrote a short post about an easy way to remove the following code from the HEAD of a WordPress […]

  6. Gamil Sawiris Says:

    what happens if you just remove this line?

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

  7. Michel Says:

    Nothing happens. The info will still be added by WP to the HEAD section of the website :)

  8. indam Says:

    thanks for sharing, regards :)

  9. Kristen Simmons Says:

    Ah thanks for this. Was looking to see how I can get rid of some of the stuff that’s generated on each page. Seems like a waste and a drag on resources to me.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Your e-mаil address will never be showed.

[ is the virtual home of Web & graphic designer Michel Bozgounov | powered by WP & hosted by DreamHost | also available in български ]

0.566 / 35 / 23