Remove "Drupal 7" generator metatag

Public

Removes the generator metatag added on all pages by Drupal. Place this on your theme's template.php

</> CopyGet raw version
php
  1. /**
  2.  * Implements hook_html_head_alter()
  3.  * Removes the "Drupal 7" generator metatag.
  4.  */
  5. function YOURTHEME_html_head_alter(&$head_elements) {
  6. unset($head_elements['metatag_generator']);
  7. }

Comments

car3oon's picture

I've checked your solution and didn't worked for me. However code below worked like a charm:

  1. function YOURTHEME_html_head_alter(&$head_elements) {
  2. unset($head_elements['system_meta_generator']);
  3. }
DavidOliveros's picture

Is it on drupal 6? I originally found that solution somewhere on the Web, but didn't worked for me on Drupal 7.

car3oon's picture

Yup
I've used it on the newest Drupal 7.20 and it working good.

alexweber's picture

This depends on whether or not the Metatag module is enabled. If it isn't, then the key you want to unset is "system_meta_generator", however if it is enabled the tag name changes to "metatag_generator".