Monday , February 3 2025

How to remove generator in Drupal 7

By default, the source code of Drupal sites contains the line <meta name=”generator” content=”Drupal 7 (http://drupal.org)” />

To remove it, you need to edit the file /sites/all/themes/mytheme/template.php (instead of mytheme, go to your site’s theme folder), find function shop_adaptive_html_head_alter and add before the closing character } this line:

unset($head_elements['metatag_generator_0']);

If it doesn’t work, try these options:

 unset($head_elements['system_meta_generator']);

or

unset($head_elements['metatag_generator']);

If there was no mention of function shop_adaptive_html_head_alter in the template.php file, then add the function:

function shop_adaptive_html_head_alter(&$head_elements) {
  unset($head_elements['metatag_generator_0']);
}

with options for unset from the examples above.

About iryna

I'm Iryna, a web developer from Ukraine with a decade of experience solving complex technical challenges in the world of freelance. Throughout my career, I've worked on everything from troubleshooting server-side issues and optimizing website performance to enhancing user interfaces. On this blog, I share detailed solutions to the technical problems I’ve encountered and methods that have worked best for me. In addition to my technical expertise, I’m also passionate about digital drawing. I hope the tutorials and insights I provide here will help both fellow developers and creatives alike in their own projects.

Check Also

Popup image on click without href

A very elegant solution, with which the image will not be wrapped in <a href=””></a>, …

Leave a Reply

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