• Resolved prehealthshadowing

    (@prehealthshadowing)


    We noticed after the WordPress 5.6 upgrade that our inline Javascript snippets were being removed from the HTML when Combine Javascript Files was enabled and the user was NOT logged in to our website. Once a user logged in, the snippets were present.

    This functionality specifically broke in the plugins Woody Snippets, DebugPress, and Contact Form 7 with ReCaptcha enabled. Things didn’t work when the user was not logged in, but worked fine after they logged in.

    Woody Snippets creates comments in the HTML where the JS is being inserted, and so we could actually see the code missing. I’m attaching two screenshots of Chrome DevTools – one before logging and and one after logging in. There are no other differences.
    Logged in: https://prnt.sc/w44opg
    Not Logged in: https://prnt.sc/w44p99

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @prehealthshadowing

    This is expected behavior. When the Combine JS files is enabled, we put the content from all js files + the inline scripts in a single file.

    However, this optimization works for non-logged-in users only and this is why you see the inline scripts when a user is logged in.

    Regards,
    Stanimir

    Thread Starter prehealthshadowing

    (@prehealthshadowing)

    Unfortunately, it seems as if the scripts are being removed, but not being placed into a new file which is being served, as none of the scripts are executing and there are no messages on the console. I have looked through the output HTML and don’t see reference to a new script tag with the combined JS in it, and I don’t see the inlined JS elsewhere on the same page.

    What is the name of the file that is supposed to be served with the combined Javascript? Could it be a conflict with another plugin?

    Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @prehealthshadowing

    The scripts are added in the combined js files, but there are errors in the console. Please use the exclude functionality that the plugin provides to fix those issues and the page will load properly.

    Regards,
    Stanimir

    Thread Starter prehealthshadowing

    (@prehealthshadowing)

    Hello Stanismir,

    Thank you for the response. The errors have been fixed on our production site already, but enabling the Combine Javascript option still causes the problem I describe.

    I have toggled the Combine Javascript setting ON on our main site if you want to try to reproduce. (I will flip it off in the morning). I do not see any sign that the scripts that have been extracted from inline are present elsewhere.

    If you can locate the scripts that have been removed from between the “Woody ad snippets” comments while not logged in, please share with me where they have been moved to. You are welcome to create an account to see the issue.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Combine Javascript files removing javascript when user is not logged in’ is closed to new replies.