• Resolved Mick Levin

    (@mick-levin)


    Hello,

    Well, thanks for the very well done plugin!

    Here’s something I am finding hard to deal with though…

    Once I put the jquery enqueue into the footer, both times wp-spamshield scripts come ahead of jquery and thus give the error of “jQuery is not defined”.

    First time it’s because the javascript.php is printed into the <head>, and the second time when the CDATA is printed (again) into before wp_footer.

    Any guess on how to make it be more controllable or may be even jquery-independent?

    Thanks!

    https://wordpress.org/plugins/wp-spamshield/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor redsand

    (@redsand)

    Hi Mick,

    You’re very welcome! 🙂

    I’m sorry to hear about the issue you’re having and I’ll be happy to help.

    If you haven’t had a chance to yet, please take a few minutes to work through the Troubleshooting Guide and FAQs, as these solve over 90% of issues users have.

    Please take special note of Troubleshooting Step 15 as it relates specifically jquery and moving it to the footer.

    From the Troubleshooting Guide:

    Make sure that you have not moved jQuery to the footer. WP-SpamShield depends on this…

    There is a possibility you could get it working by using Compatibility Mode. (No guarantees though.)

    A few things regarding this:

    • You’ll need to make sure that your site is actually loading jQuery.
    • You’ll need to check your dependencies and script enqueue priorities.
    • When you enqueue it in the footer, you really need to know what you’re doing.

    Keep in mind that many scripts depend on jQuery. It’s risky to put it in the footer, and we don’t usually recommend it because most people can’t pull it off without breaking some code. It’s one of those things that really only people who know they can pull it off should do it, at least on a production site.

    I understand you’re probably going for performance improvements. Site speed optimization is one of the things we do day in and day out for clients, so we know a bit about this. If you do what you can to reduce code bloat, losslessly optimize your images, use CSS sprites, properly leverage browser caching, use a minification/concatenation plugin and a page caching plugin, and use other good optimization practices, jQuery won’t be your bottleneck…so you may want to consider putting it back in the header. We’ve got some sites loading in .6 seconds with jQuery in the header. Just my two cents on that.

    Hope that helps!

    Keep in mind that we said Compatibility Mode may help those who make mods and move jQuery to the footer. No guarantees. When you make mods like that, the debugging is up to you. 🙂

    – Scott

    Thread Starter Mick Levin

    (@mick-levin)

    Thanks Scott,

    I’ve figured as much…

    I am trying to find a way to still put jQuery into a footer – that’s one of my “must have” things, and I am working with each plugin author which has a dependency on jQuery, to make sure that it still works when all scripts are in the footer.

    Sorry, but I just can’t let it be in a header. I am not on WPengine, thus every bit of optimization I can do, I will. So… for now I am keeping it in the header. But I am going to dig around to find a way to fix that, one way or other.

    Cheers.
    Mick.

    Plugin Contributor redsand

    (@redsand)

    You’re very welcome. Have a good one. 🙂

    – Scott

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘jQuery dependency broken when jQuery is in footer :(’ is closed to new replies.