• Resolved adamovic

    (@adamovic)


    Hi guys,

    I’m having a problem with Autoptimize and I cant figure out what’s going on. Attempting to combine javascript and css files into fewer files to reduce the number of HTTP requests upon page load I installed Autoptimize and it worked great. Then I noticed some elements on my page broke, which was somewhat expected. Since I didn’t know exactly which scripts needed to be excluded, I deactivated Autoptimize and decided to start again from scratch. But as I deactivated the plugin a bunch of jquery errors popped up in DevTools.

    Screenshot of site before:
    screenshot-of-site-before

    And screenshot of site after deactivation:
    screenshot-of-site-with-errors

    If I open the site while logged in to wordpress, I don’t see the errors and the site looks right but if I go incognito or use another browser/computer, the errors appear. I guess that’s an admin/cache thing.

    I can’t undo things more than I already did with deactivating the plugin and if possible, I would like to continue using Autoptimize + figure out which scripts and css to exclude if possible.

    Any ideas?

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    you seem to be using “Async Javascript”, in there you’ll have to exclude jQuery from being either asynced or deferred.

    Thread Starter adamovic

    (@adamovic)

    That was fast, thank you!

    It is better but some errors remain.
    site with less errors

    What I don’t get is why didn’t I get these errors before? I have Async Javascript for quite some time now and jquery was never excluded yet the site worked fine.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    still seeing jquery asynced I’m afraid:

    Thread Starter adamovic

    (@adamovic)

    Hmm, I tried asyncing jquery, defering jquery, excluding jquery and deactivating async plugin but nothing works. Actually all errors remain, I spoke too soon before.

    Right now I have both async and autoptimize deactivated. Does it make more sense to try solving the errors with plugins deactivated or activated as the problem began when I deactivated Autoptimize?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    start with AsyncJS disabled and AO enabled + make sure all page caches are cleared, we’ll take it from there 🙂

    Thread Starter adamovic

    (@adamovic)

    Ok, I activated AO with the same settings as before.
    Currently I have these locations excluded for both javascript and css:
    – wp-includes/js/dist/,
    – wp-includes/js/tinymce/,
    – js/jquery/jquery.js,
    – wp-content/plugins/elementor/,
    – wp-content/plugins/unlimited-elements-for-elementor/

    The first 3 were already there by default.
    The errors are now gone but there are almost no pictures on site. I’m guessing I have to exclude some css?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ok can you add wp-content/themes/neve/defer-recaptcha.js or if that does not work wp-content/themes/neve/ to the JS optimization exclusion list as well?

    Thread Starter adamovic

    (@adamovic)

    I’m suspecting that I should somehow exclude additional CSS from the Theme Customizer. In there I have css applying to site logo, mobile menu, fixed elements, …, which all seem to be affected by AO. But I don’t know where the additional css is stored 😛

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    first things first; do images show when “optimize CSS” is off?

    Thread Starter adamovic

    (@adamovic)

    Ha! Adding wp-content/themes/neve/defer-recaptcha.js worked, all images are back 🙂
    Now there’s only one thing left – the big white space under the header on front page and the “side menu” (the grey rectangle with 3 links) which should be fixed to the right side of the page.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ok, so does that white space go away when disabling CSS optimization?

    Thread Starter adamovic

    (@adamovic)

    Yes, it does. Uncheck aggregate?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    good idea 🙂

    Thread Starter adamovic

    (@adamovic)

    Ok 🙂 everything works.
    If I wanted css to stay aggregated, I would need to find the css file which should be excluded and add it right?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, next up; re-enable “aggregate CSS” but disable “also aggregate inline CSS”?

Viewing 15 replies - 1 through 15 (of 21 total)

The topic ‘jquery error’ is closed to new replies.