Archived topic
Elements hook in header OR just before closing tag
1 reply · Started by Mikko on September 14, 2020
I was told to "..include JS file in header or just before closing </body> tag. ".
I created element in GP Premium but I'am not sure which "hook" should I choose from drop-down list to best reflect those positions in the code.
1. Which GP hook should I use to install the JavaScript code so it goes to "header"?
2. Which GP hook should I use to install the JavaScript code so it goes to "just before closing </body> tag"?
Hi there,
there are three core WP hooks that cover the main places to add scripts:
WP_head - inside the <head></head> ie. header
WP_footer - before the closing </body> tag
WP_body_open - immediately after the opening <body> tag - commonly used for Google Tag Manager.