Hi,
Sometimes, when you copy/paste the required PHP code snippet, the ‘ character gets converted into another version which can not be correctly interpreted by PHP. Please double check whether your code in header.php is using the only accepted ‘ character instead of ‘ for example.
Hi
I just checked the code in my childtheme header.php file and is exactly like the one you say to put in the plugin : <?php if ( function_exists( ‘gtm4wp_the_gtm_tag’ ) ) { gtm4wp_the_gtm_tag(); } ?> . I wrote it just after the <body <?php body_class(); ?>> tag
Please help me , what can I do ?
If the body element is defined as in your code sample above, then use the codeless placement option instead of adding the provided PHP code manually.
Hi,
I have the same issue.
I already errase the script but everytime I enter the site, the message is still there:
“Warning: Use of undefined constant ‘gtm4wp_the_gtm_tag’ – assumed ‘‘gtm4wp_the_gtm_tag’’ (this will throw an Error in a future version of PHP) in /home/triponco/public_html/wp-content/themes/rehub-theme/header.php on line 17”
How can I fix it?
Cheers,
Damian
Hi Damian,
You need to open this file:
/home/triponco/public_html/wp-content/themes/rehub-theme/header.php
… search for gtm4wp_the_gtm_tag and remove the corresponding lines.
If this header.php file is somehow restored by any protection/automation, you need to contact your website developer or hosting provider to find out why this is happening and how you can override this mechanism.
I have the same issue, I’m using Neve Theme + Child Theme, I think you should revise your script…
I had the same issue, i solved the problem changin the aesthetic semicolons ‘ with simple semicolos ‘.
I am having problems with GeneratePress + Elementor because the code is placed inside de <body> tag. Example: <body TAG> instead of <body><tag>.
Then I decided to add it via hook and I solved the issue.
add_action( ‘wp_body_open’, ‘rr_gtmcode_insert’, 5 );
function rr_gtmcode_insert() {
if ( function_exists( ‘gtm4wp_the_gtm_tag’ ) ) { gtm4wp_the_gtm_tag(); }
}
Hope it works for someone else.
BTW, check the ‘ when copy/paste.