Problem with adding scripts to headers

Hi

I have 2 websites that I need to install Google Tag Manager snippets in the header and body of every page.

When I try to add the code using Insert Script In Headers And Footers plugin, I get a 404 Page not Found error. I have tried every other similar plugin, but the same occurs.

I have checked plugin compatibility and my Wordpress and theme is up to date.

Could you help me find out why I get the 404 redirect when I try to save?

Hi @designbythink,

Thanks for reaching out.
There might be some different reasons behind your issue, I would like to suggest troubleshooting the following common issue to help us to recognize the reason.

1.Theme Related Issue
2.Plugin Conflict, even if you have already checked this point I would request you reperform this once.
3.Theme Update related issue
4.Child Theme Related issue
5.CSS/JS Customization
6.Disabling Cache
7.Disabling CDN

If you discover that an issue is coming from a custom code or 3rd party plugin, kindly consult with a developer or contact the plugin author. Please note that we do not provide support for custom codes and 3rd party plugins.
I would also suggest you check by activating any of the default themes like *TwentyTwenty. If the issue does not exist with it, and it is caused by our theme, please copy your live site to a staging server so we could troubleshoot freely without breaking your live site.
And give us access in the secure note including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

Thanks

Hi, I have now copied my site over to a staging site. Will add details in a secure note.

  • I have tested the theme and plugin compatibility again, and it still doesn’t work.

  • Caching has been disabled, there is no CDN

  • I have tested several plugins that can insert scripts in the header, body and footer of a site, and they all have the same problem.

At this point any insight will be useful. Even if you can just confirm that it’s the server settings (or whatever) that’s causing this, so that I can go back to my hosting company and give them the information to help me.

Hello @designbythink,

I tried to access your site staging site dashboard but I am not able to access your dashboard, it seems there is an issue with your staging installation, it might be the issue of plugin conflict. I would suggest you please add the below-given code into your wp-config.php for debugging setup and the error logged into the file name debug.log inside the wp-content folder.

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
//SET PHP INI DISPLAY ERROR FALSE
@ini_set( 'display_errors', 0 );

Please find the video that will help you to edit wp-config.php and add the above code: https://www.youtube.com/watch?v=3SDPTafEM8o

Please share the FTP details in the secure note so that we can debug it properly.

Thanks

Hi

Do you mean I should add the code to the main site? Or the staging site?

Hello @designbythink,

We are not able to access the dashboard of the staging server. I would request you please fix the staging server so that we can assess the staging site dashboard or you need to add the code that I have shared in the staging server wp-config.php file. I have shared the video tutorial above posts so that you can add the code properly.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.