[Support request] Hooks settings page 404 with Google Tag Manager code

Home Forums Support [Support request] Hooks settings page 404 with Google Tag Manager code

Home Forums Support Hooks settings page 404 with Google Tag Manager code

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #295686
    Dave Foy

    Hi there,

    I have an issue where when I save my GP Hooks settings, I get a front-end 404 page at /wp-admin/options.php

    It’s only when I add Google Tag Manager code to wp_head. Any other time the hooks settings save fine.

    I can add the exact same GTM code to any other hook – saves fine. It’s only the GTM code in wp_head. Any other code in wp_head saves fine too.

    Here it is:

    <!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-PSNBZP4');</script>
    <!-- End Google Tag Manager -->

    I’ve added GTM to hooks in several GP sites now, so it’s a bit baffling!

    I’ve tried completely removing all other code from the other hooks, saving the page, and then adding the GTM code to wp_head. I did this in case some other code in the other hooks is clashing or badly-formed. It still gives a 404.

    Have you any ideas how I can troubleshoot?

    Thanks for your help.

    #295835
    Tom
    Lead Developer
    Lead Developer

    Just gave it a shot on my test site, didn’t have any issues.

    Technically, there’s no difference between each of those textareas – they all save and display the same, they’re just added into different areas.

    Have you tried deactivating your other plugins one by one to see if there’s a conflict?

    #297883
    Dave Foy

    Thanks for the reply Tom. Sorry for the delay back!

    I deactivated every single plugin, all at once: still the same problem. πŸ™

    Erm… do you have any other debugging ideas?

    Thanks Tom.

    #298000
    Tom
    Lead Developer
    Lead Developer

    So it’s just this one site, but it’s not a conflicting plugin. Hmm..

    Anything else different about this site vs your others? Different hosting? Custom PHP? Other scripts added?

    #322102
    Dave Foy

    Just reporting back on this one (it’s been a while!)

    I cloned the site to my local server – no problems there. I figured it must be something to do with the shared hosting environment this particular site is on.

    They tell me it was triggering a mod_security rule and needed whitelisting. Once done, all worked fine.

    Thought it might be helpful if anyone reports similar in future.

    Interestingly, when I tested this in Chrome earlier (before the fix), I now got the following error screen, not the 404:

    https://cl.ly/2O2N2b0A2u3R

    Anyway, pleased it’s all working now. πŸ™‚

    Dave

    #322321
    Tom
    Lead Developer
    Lead Developer

    Glad to hear it’s all working now! Thanks for reporting back πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.