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! :-)

9 comments |



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

  1. Noxx Says:
    1

    Hey mate,

    Thanks for the post :)

    Cheers

  2. DG Says:
    2

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

  3. wino Says:
    3

    Thanks for the fix!

  4. grace Says:
    4

    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:
    5

    […] 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:
    6

    what happens if you just remove this line?

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

  7. Michel Says:
    7

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

  8. indam Says:
    8

    thanks for sharing, regards :)

  9. Kristen Simmons Says:
    9

    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.


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

0.494 / 27 / 17.5