Header script inside script causing issues

I am using Manychat’s buttons on my page, and had issues with them, so contacted their support, who came back with this answer:

Finally received a word from dev team that “With checkbox” growth tools doesn’t work properly because ManyChat Snippet () is inserted in the wrong place:

Please edit your pages and move to part. Also, please don’t put it in other


Now I added the code inside my child theme’s functions.php the following way:

// Begin ManyChat in Head Tag
// =============================================================================
add_action( 'wp_head', 'add__manychat_to_header', 999 );

function add__manychat_to_header(){
?>
<!-- ManyChat -->
	<script src="//widget.manychat.com/714323188721850.js" async="async"></script>
<?php
}
// End ManyChat in Head Tag

So I was hoping you could give me an answer as to how I might fix this issue.
I honestly do not understand if the script is not inside the header already, and I am clueless regarding the script inside a script issue.

Any help would be much appreciated!
Thank you

Hi There,

Thanks for writing in! The following resource should help you to setup it correctly (http://www.rightlydigital.com/how-to-setup-facebook-messenger-bots-on-wordpress-in-5-minutes/).

Hope that helps.
Thanks!

I’m sorry for my expression here, but what a useless comment.

I asked for technical support regarding the theme, and you send me some manychat guide for beginners.

I have already installed the script in my header in the way I described above, so why do the manychat team tell me it hasn’t been done correctly?

Please don’t ask me to install a plugin to fix something this simple… My site is slow enough as it is

Thanks

Hi There,

I have given you that resource because I have seen another thread of yours having the same issue (https://theme.co/apex/forum/t/where-to-add-script-in-x-pro-header-using-child-theme/9884).

If you don’t have technical knowledge, you can follow alternative path.

Thanks!

Hi again

I am sorry for my blunt response the other day, but I am under a bit of pressure here to make this work.

The thread you are referring to was solved. I had forgotten to active my child theme. so please don’t confuse that issue with my current!

I need a technical solution to the issue I am having with this script.

I need to know why it appears inside another script, and why they might tell me it doesn’t show in the header, when I so clearly have done what I was told by you guys.

Again I refer to my first post, please read it carefully and help me out.
I need it badly!

Hi there,

The issue is that you have loaded the script twice.

You added it in Pro > Theme Options > JS and you have loaded it through the function.php as well.

If you remove the code added in the Theme Options, it will get rid of this issue:

<script id="x-customizer-js">
  <!-- ManyChat -->
<script src="//widget.manychat.com/714323188721850.js" async="async">
</script>    </script>

Once you do that, you should not have any JS error for the script because you already loaded it through the child theme’s functions.php

1 Like

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