Remove generator metatag from Drupal

If you want to delete automated metatag from drupal (<meta name=”Generator” content=”Drupal 7 (http://drupal.org)” />) then the following code may be useful for you:

Just make a function yourthemename_html_head_alter() under your themes template.php and try the below code:

function yourthemename_html_head_alter(&$head_elements) {
unset($head_elements[‘metatag_generator’]);
}

Instead of that  unset($head_elements[‘system_meta_generator’]); can also work but the above code worked for me.

I got  metatag_generator array when i print the $head_elements array .So logically we should unset metatag_generator if we want to remove <meta name=”Generator” content=”Drupal 7 (http://drupal.org)” /> .

Leave a Reply

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