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 thoughts on “How to remove <meta name="generator" content="WordPress…" /> from <head> in a WP blog

  1. 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.

  2. what happens if you just remove this line?

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

  3. 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

Your email address will not be published. Required fields are marked *