If I include a later version of jQuery in WordPress things like the Widgets page is no longer working. When I try to click on the down arrow in a specific widget to update it it doesn’t show its settings.
wp_enqueue_script('ecom_jquery_script', 'http://code.jquery.com/jquery-1.9.0.min.js');
wp_enqueue_script('ecom_jquery-ui_script', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js');
wp_enqueue_script('ecom_flexslider_script', plugins_url('/js/ecom-jquery.flexslider.js', __FILE__));
wp_enqueue_script('ecom_admin_script', plugins_url('/js/ecom-main.js', __FILE__));
But when I comment out jquery and other scripts that depends on it the widgets page will work.
I’ve already tried looking for solutions but the common solution is making jquery no conflict:
$j=jQuery.noConflict();
// Use jQuery via $j(...)
$j(document).ready(function(){
alert('test');
});
But this doesn’t work because simply including a newer version of jquery will make scripts that depends on the older version of jquery to not work. Please help.
Deregister script doesn’t work either since wordpress simply refuses to work if a newer version of jquery is used:
wp_deregister_script('jquery');
I’m sure they are few tricks you can do to get this work, but I think the best (for version compatibilities) is to include the jQuery Migrate Plugin. This plugin provides two essential facilities:
The migrate plugin should be loaded immediately after jQuery, e.g.
However, you should take a look of the changelog of the last jQuery version.
NOTE: The
wp_deregister_script('jquery')
function is working, but you need to register again with the same name (jquery) and then enqueue like this: