- This topic has 5 replies, 2 voices, and was last updated 6 years, 10 months ago by Tom.
-
AuthorPosts
-
March 22, 2017 at 5:23 am #295686Dave 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.
March 22, 2017 at 10:31 am #295835TomLead DeveloperLead DeveloperJust 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?
March 27, 2017 at 4:46 am #297883Dave FoyThanks 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.
March 27, 2017 at 9:37 am #298000TomLead DeveloperLead DeveloperSo 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?
May 22, 2017 at 3:19 am #322102Dave FoyJust 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:
Anyway, pleased it’s all working now. π
Dave
May 22, 2017 at 11:22 am #322321TomLead DeveloperLead DeveloperGlad to hear it’s all working now! Thanks for reporting back π
-
AuthorPosts
- You must be logged in to reply to this topic.