• I am trying to add two scripts to the header of my site using plugin “Header and Footer Scripts”. My site is https://theawesomemuse.com/

    I am able to add either of the two scripts, but I cannot add both. When I try to do so, I receive a 500 error.

    Even the following example produces a 500 error:

    <script type="text/javascript">console.log("testA")</script>
    <script type="text/javascript">console.log("testB")</script>

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Anand Kumar

    (@anand_kumar)

    Hello,

    I can’t reproduce the error with the code you shared. Try reinstalling the plugin. May be there might be file permission issue.

    Let me know if it doesn’t fix.

    Thread Starter jquisenberry

    (@jquisenberry)

    Hello,

    Reinstalling the plugin does not resolve the issue. I doubt that there is a permissions issue because I can install one script, such as

    <script type="text/javascript">console.log("testA")</script>

    Even though I cannot install two scripts, such as

    <script type="text/javascript">console.log("testA")</script>
    <script type="text/javascript">console.log("testB")</script>

    I have found that this issue applies not only to the Header and Footer Scripts plugin. I have tried the following techniques, and all produce an error:

    * Plugin Header and Footer Scripts
    * Plugin Insert Headers and Footers
    * Theme Customizer (Appearance -> Customize -> Theme Settings -> Header/Footer Scripts
    * Editing the theme’s functions.php using Appearance -> Theme Editor as follows:

    add_action('wp_head', 'your_function_name0');
    function your_function_name0(){
    ?>
    <script type="text/javascript">console.log("your_function_0");</script>
    <script type="text/javascript">console.log("your_function_1");</script>
    <?php
    };
    
    Thread Starter jquisenberry

    (@jquisenberry)

    Even though the issue does not appear to be specific to Header and Footer Scripts, I would appreciate any information you can provide about what might be rejecting the code I seek to add.

    In other tests, I was unable to add the <noscript></noscript> tags.

    Plugin Author Anand Kumar

    (@anand_kumar)

    Since the issue is not related to the specific plugin I can’t be much helpful. But, IMO You will need to try default WordPress theme to make sure it’s not the theme. If the culprit is not the theme then most likely it is one of the plugin. Deactivate plugins one by one to find the buggy one.

    PS: Deactivate least popular plugins first.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cannot Add Two Scripts’ is closed to new replies.