[wp-trac] [WordPress Trac] #22896: Prevent plugins from overriding jQuery in the admin

WordPress Trac noreply at wordpress.org
Thu Jan 24 18:30:49 UTC 2013


#22896: Prevent plugins from overriding jQuery in the admin
------------------------------------+------------------
 Reporter:  nacin                   |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  3.6
Component:  External Libraries      |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
------------------------------------+------------------

Comment (by azaozz):

 With jQuery there is a better way to do this: let the WordPress jQuery
 load first, then load your desired version in the footer or right before
 it's needed, load jQuery UI or any other plugins you want to use with the
 different version and do:

 {{{
 var myjq = jQuery.noConflict(true);
 }}}

 Ref: http://api.jquery.com/jQuery.noConflict/#example-4

 Then in your scripts you can use the version you want:

 {{{
 (function($){
 // your code here uses the alternative jQuery version
 }(myjq));

 (function($){
 // this uses the standard jQuery version
 }(jQuery));
 }}}


 This is '''the proper way''' to load several versions of jQuery and have
 them all work and (of course) doesn't affect or break anything in
 WordPress.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22896#comment:30>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list