WordPress.org

Ready to get started?Download WordPress

Forums

check which plugins do load the same jquery (4 posts)

  1. Ovidiu
    Member
    Posted 3 years ago #

    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/pacura.ru/web/wp-content/themes# grep -R -i 'jquery-ui.min.js' ../../wp-content/
    ../../wp-content/plugins/thethe-sliding-panels/lib/lib.php:     wp_register_script( 'jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js');
    ../../wp-content/plugins/j-shortcodes/j-shortcodes.php:         wp_register_script   ('jquery-ui-core',   "http://ajax.googleapis.com/ajax/libs/jqueryui/{$jquery_ui_version}/jquery-ui.min.js");
    myserver:/var/www/pacura.ru/web/wp-content/themes#

    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?

  2. s_ha_dum
    Member
    Posted 3 years ago #

    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.

  3. Ovidiu
    Member
    Posted 3 years ago #

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

  4. robthecomputerguy
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic