I'm looking for a way to edit the $head variable of the html.tpl.php. Where exactly is this variable composed and set?

1 Answer 1


The most common way to add information to the <head> is using drupal_add_html_head().

If the data you want to alter was added using that function, you can alter it by implementing hook_html_head_alter() within a custom module. Using the alter hook requires that you know the $key of the data that was added during drupal_add_html_head().

If you want to alter CSS or JS, use hook_css_alter() and hook_js_alter() respectively.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.