• Resolved eltarny

    (@eltarny)


    Hello,

    One of my sites automatically updated to WordPress 5.6, and immediately got destroyed.
    In the browser console multiple “jQuery is not defined” errors appeared.

    After some tests, I deactivated Autoptimize, and the error disappeared and everything was fine.

    I managed to have Autoptimize enabled by unchecking the Aggregate JS-files option.

    The exact same thing happened to all my sites (over 20 sites with various themes and plugins), and the solution of unchecking Aggregate JS-files option worked to all of them.

    Can it be that the new WordPress changed something in the order of the scripts loading and that messes up with the aggregation of the JS files?

Viewing 15 replies - 1 through 15 (of 29 total)
  • Same error for me . thanks a lot.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, there indeed are important jQuery changes in 5.6, as shown on the “welcome” page after updating:

    now “jQuery is not defined” typically is because jQuery is not excluded from JS optimization, try adding js/jquery/jquery.js to the comma-separated exclusion list (and make sure jQuery is not asynced/ deferred with e.g. Async Javascript)?

    Thread Starter eltarny

    (@eltarny)

    Never removed js/jquery/jquery.js from the comma-separated exclusion list and it is not asynced or deferred.

    • This reply was modified 3 years, 11 months ago by eltarny.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    can you share you site’s URL?

    Thread Starter eltarny

    (@eltarny)

    This is one of my test sites with the aggregation on so you can see the errors.
    edit — deleted URL —

    • This reply was modified 3 years, 11 months ago by eltarny.

    so i have in Exclude scripts from Autoptimize: wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js
    but still it have error
    Uncaught ReferenceError: jQuery is not defined
    at (index):569
    (index):1162 Uncaught ReferenceError: jQuery is not defined
    at (index):1162
    (index):494 Uncaught ReferenceError: jQuery is not defined
    at revinit_revslider61 ((index):494)
    at HTMLDocument.<anonymous> ((index):537)

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    aha, found it; 5.6.0 changes the filename of jQuery, so you’ll have to change js/jquery/jquery.js into js/jquery/jquery.min.js ..

    so easy i am perfect now thanks a lot.

    Thread Starter eltarny

    (@eltarny)

    Worked like a charm!

    Thank you!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    thanks for warning me, this will be a huge issue the coming days … *grin*

    Thread Starter eltarny

    (@eltarny)

    My pleasure for your awesome plugin!
    Let’s hope that people see this thread and resolve it themselves.

    For those using also Async JavaScript plugin, you also have to exclude js/jquery/jquery.min.js in the Script Exclusion section.

    See a screenshot here: https://snipboard.io/ZldUgH.jpg

    @optimizingmatters Maybe it would make sense to publish a new version where this string is added to the exclude list by default. This will save some hundred thousand sites from breaking and reduce also the support load for other plugin and theme authors. Thank you! ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    https://github.com/futtta/autoptimize/archive/beta.zip has that fix Chris, would be great if I could have some people test ??

    I installed Version 2.8.0-beta-3 on two sites and tested only the issue mentioned in this thread. All seems to work now, the string is added to the list and the JS error disappeared.

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘jQuery is not defined after updating to WordPress 5.6’ is closed to new replies.