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


We want to the countryside on this Sunday…

Small spider in a web

I ‘catched’ this small spider using our modest Canon S5 IS, a few seconds before it was lost somewhere in the grass… :-)

The Sunrise…

…this morning was very beautiful, and so was the sky…

The sunrise over Sofia city this morning

(Usually I sleep at this time of the day, but there are exceptions to the rule… like today. And now I go to make tea and coffee and wake up my beloved;-)

Read more