Support » Fixing WordPress » check which plugins do load the same jquery

  • on a test site, not publicly reachable, I seem to have two versions of jquery.

    I grepped for the library through my wp-content folder and found this:

    myserver:/var/www/ grep -R -i 'jquery-ui.min.js' ../../wp-content/
    ../../wp-content/plugins/thethe-sliding-panels/lib/lib.php:     wp_register_script( 'jquery-ui', '');
    ../../wp-content/plugins/j-shortcodes/j-shortcodes.php:         wp_register_script   ('jquery-ui-core',   "{$jquery_ui_version}/jquery-ui.min.js");

    these look to be loading the same library but different versions, right?

    I googled a bit and I think there should be some wp_enqueue_script( ‘jquery-ui.min.js’ ); or similar to prevent it being loaded double, shouldn’t there? sorry for the ignorance I have no idea about js 🙁

    should I tag those two plugins (both active on my site) and ask them to check or am I totally wrong here?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes. It looks like two different plugins are loading (probably) the same jQuery library.

    WordPress will prevent double loading if it can but in your case the two scripts are registered under different names– ‘jquery-ui’ and ‘jquery-ui-core’– so they are going to appear different to the system. I see why they did it. They are both loading from Google’s libraries and chose reasonable names to load under. They just chose different reasonable names.

    Personally, I don’t think that is a very friendly way to load jQuery. jQuery is bundled with WordPress. I think a plugin author should just load that bundled jQuery. This will prevent double loading when different authors load the same thing under different names. The user can then decide whether to load from the Google libraries or not. There are plugins that will do this globally.

    Thanks for the feedback, I guess I’ll tag the two plugins here maybe the authors will have a look at it…

    Is there any way for the above-average user to simply do a find/replace in one plugin’s script to change the jquery-ui-core to match the name of the other so that WordPress can do that prevent-double-loading-thing you mentioned?

    Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘check which plugins do load the same jquery’ is closed to new replies.