Support » Fixing WordPress » jQuery error in custom theme after upgrading to 5.3

  • Resolved gerital

    (@gerital)


    After upgrading to WordPress 5.3 this Javascript error shows up in the console:

    Uncaught TypeError: $ is not a function
        at bindPlayer (xrcbplayer.js?ver=20180910:114)
        at HTMLDocument.<anonymous> (xrcbplayer.js?ver=20180910:95)
        at i (jquery.js?ver=1.12.4-wp:2)
        at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
        at Function.ready (jquery.js?ver=1.12.4-wp:2)
        at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)

    I know that it is a problem of my custom theme – but it wasn’t there with WordPress 5.2. So I would like to know if there have been made any chances to jQuery I should have in mind in 5.3?

    I already fixed it by changing all $ appearances to jQuery, or put everything inside jQuery(document).ready(function($) { });.

    But I still would like to know why this happened. It seems to me so that the order of loading libraries has changed somehow…

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • hi There!

    This happened because the mediaelement.js script was leaking jQuery as $ in previous WordPress versions. This was fixed recently.

    See https://core.trac.wordpress.org/ticket/48568 for more information. The recommendation in WordPress is to always use jQuery instead of $.

    Thanks.

    Thanks for the explanation.

    Scusate amici.
    Dopo un aggiornamento mi รจ stato restituito il seguente errore.
    Chiedo scusa ma sono un principiante. Grazie.
    ______________________
    Warning: Declaration of PLL_Walker_Dropdown::walk($elements, $args = Array) should be compatible with Walker::walk($elements, $max_depth, …$args) in /web/htdocs/www.acpr.cloud/home/wp-content/plugins/polylang/include/walker-dropdown.php on line 0

    I have developed a plugin to solve this problem (not permanently).

    The link of this plugin is https://github.com/LuRenJiasWorld/jQuery-WP53-Fix .

    Just install it and see what you can get, if everything works as expected, all errors related will disappear in the console, and your plugin will work fine.

    If you have any problems when using this plugin, feel free to submit the issue.

    Best regards.

    • This reply was modified 3 months, 1 week ago by lurenjiasworld. Reason: Fix typo
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.