A few years ago I added Google Tag Manager tag to the _header.php file of the X Pro child theme, i.e. this file framework/views/global/_header.php, and then promptly forgot about it because it worked fine.
That was until 6-weeks ago when it seems like the _header.php file stopped being used and as a consequence the GTM tag stopped being loaded on the site.
Around the same time I re-built the global nav using the Header Builder that’s available in Pro. So I have a few questions:
- Does creating a custom header assigned to all pages mean that the _header.php file is no longer used / loaded? Or is the issue related to something else?
- To fix the problem, I’ve loaded the GTM tag via the functions.php file of the child theme using the wp_head hook and it seems to be working. Is it best practice to load tags like the GTM tag via the functions.php file? Or should I be using a different method?
Any info you can provide as to why this issue occurred would be much appreciated.
Brendan