Hooking into the HTML header container

Unless a theme provides such a hook there is no way to do this with actions and filters. If a hook is provided then it will be theme specific, no generic WP solution exists.

For a full list of the hooks that a theme should implement, see here:

https://developer.wordpress.org/themes/advanced-topics/plugin-api-hooks/

At the moment this includes:

  • wp_head() Goes at the end of the element of a theme’s header.php template file.
  • wp_body_open() Goes at the begining of the element of a theme’s header.php template file.
  • wp_footer() Goes in footer.php, just before the closing tag
  • wp_meta() Typically goes in the
  • Meta
  • section of a Theme’s menu or sidebar.

  • comment_form() Goes in comments.php directly before the file’s closing tag ()

Note that aside from wp_head and wp_footer, there is no guarantee that the theme developer knew to add them, or did so correctly, particularly wp_body_open and wp_meta