Archived topic
wp_head versus before header location in hooks element
1 reply · Started by George on January 25, 2019
1. Could you please tell me what the difference is between these two locations in the hooks element section:
'wp_head' - and 'before header content'.
https://www.screencast.com/t/FKa0gMoUmf
2. The first block of the google tag manager code is supposed to go into the 'wp_head' section, and the second block into the 'before header' section. However I saw in google tag manager that this second block is supposed to go right after the opening <body> tag. So now I am not clear what exactly the best placement for it is.
3. Is the 'wp_head' the same as the 'header', or is this a different thing?
Hi there,
WP_Head and Header are two different things.
WP_Head is the real important <head> area of your website. Used for adding meta and links for scripts etc. It should never be used for displaying content.
before_header is a GeneatePress Hook and appears immediately after the opening <body> tag.
So for Google tag manger, the first code goes in wp_header and the second code in before_header