Support » Plugin: Autoptimize » WordPress 5.6: jQuery not defined fix

  • ResolvedPlugin Author Optimizing Matters

    (@optimizingmatters)


    WordPress 5.6.0 changes the filename of jQuery, so anyone who gets “jQuery is not defined” errors will have to change js/jquery/jquery.js into js/jquery/jquery.min.js in the JS optimization exclusions.

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

    (@optimizingmatters)

    This will be fixed in AO 2.8, but I need testers to confirm, download https://github.com/futtta/autoptimize/archive/beta.zip and disable the current version before activating the beta.

    Looking forward to feedback!
    frank

    I’m running the attached beta version, and I can confirm that it doesn’t contain the jQuery bug.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thanks for confirming, I just released 2.8! 🙂

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    fixed with AO28 release 🙂

    Imporant hint, especially for all who uses revoluion slider:

    You should not only change the entry in the exclusion section from

    js/jquery/jquery.js
    to
    js/jquery/jquery.min.js

    but also specify it in addition! 🙂

    The following should therefore be entered in the exclusion section:
    js/jquery/jquery.js,js/jquery/jquery.min.js

    That helped me! 🙂

    • This reply was modified 6 months, 2 weeks ago by The-Dude.

    Is there a specific order of operations to force AO2.8 to modify the excluded scripts string to include jquery.min.js? I’ve tried upgrading to 2.8 both before and after upgrading to WP5.6 and in neither case was jquery.min.js appended to my list of excluded scripts.

    * I tried a custom list of scripts which did not have jquery.min.js appended:

    s_sid,smowtion_size,sc_project,WAU_,wau_add,comment-form-quicktags,edToolbar,ch_client,seal.js,jquery.js,reviews.widget,scheduler.widget, wp-content/plugins/revslider/, wp-content/plugins/gravityforms/

    * The following excluded string DID get jquery.min.js added to the end:

    wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, wp-content/plugins/revslider/, wp-content/plugins/modal-window/, wp-content/plugins/gravityforms/, wp-content/plugins/UABB/

    * I thought maybe your append search was looking for the inclusion of “js/jquery/jquery.js” and it appears that was a correct assumption. I modified the first completely non-default string to include the old-style WP path to jquery:

    s_sid,smowtion_size,sc_project,WAU_,wau_add,comment-form-quicktags,edToolbar,ch_client,seal.js, js/jquery/jquery.js, reviews.widget,scheduler.widget, wp-content/plugins/gravityforms/, datepicker.min.js

    which was updated to:

    s_sid,smowtion_size,sc_project,WAU_,wau_add,comment-form-quicktags,edToolbar,ch_client,seal.js, js/jquery/jquery.js, reviews.widget,scheduler.widget, wp-content/plugins/gravityforms/, datepicker.min.js, js/jquery/jquery.min.js

    If the conclusion I’ve come to is in fact accurate, I STRONGLY suggest simply setting the minimum requirement of the script exclusion string containing the regex

    /,.*?jquery\.js.*?,/

    have appended “js/jquery/jquery.min.js”, or perhaps more generically “jquery.min.js”

    or maybe you could use a regex of

    /,(.*?)jquery\.js(.*?),/

    replaced with

    “,$1jquery.min.js$2,”

    I think it’s of greater service to the plugin users to be overly-proactive about excluding jquery.min.js with the WP5.6 upgrade. As-is, the addition of jquery.min.js to the exclusion only addresses the WP-specific jquery, but if any site which has modified the _way_ jquery is excluded, the worst-case scenario of the site breaking will happen. Being more fast-and-loose about appending jquery.min.js to the exclusion string has the worst-case scenario of a single JS file being excluded from the autoptimize bundle.

    I’m going to post this reply to the handful of other topics related to the WP5.6 upgrade so that it’s as visible and discoverable as possible to others looking into this.

    I installed this beta and it helped to solve most of the problems, but I still have this issue with the wp-review-slider-pro plugin

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.