• Hi
    I installed GTM through your plugin with the personalized option and this code:
    <?php if ( function_exists( ‘gtm4wp_the_gtm_tag’ ) ) { gtm4wp_the_gtm_tag(); } ?> just after the <body> tag on my header.php file.

    Right now I′m receiving this message on my website:
    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/customer/www/runayaq.com/public_html/wp-content/themes/oceanwp-child/header.php on line 18

    Please help me, what′s the problem ?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    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.

    Thread Starter freddyee

    (@freddyee)

    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 ?

    Plugin Author Thomas Geiger

    (@duracelltomi)

    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

    Plugin Author Thomas Geiger

    (@duracelltomi)

    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 ‘.

    mseculi

    (@mseculi)

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Undefined constant’ is closed to new replies.