I want to use the latest jQuery (and jQuery UI) versions on my admin interface (editing a specific post type that I created).
I tried this:
// jQuery 1.x
wp_register_script('jquery1x', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, null, true);
// jQuery UI 1.8.4 PTBR
wp_register_script('jquery-ui-custom-pt_BR', THEME_URL . 'js/jquery.ui.datepicker-pt-BR.js', array('jquery1x'), null, true);
// jQuery UI 1.8.4
wp_register_script('jquery-ui-custom', THEME_URL . 'js/jquery-ui-1.8.4.custom.min.js', array('jquery1x', 'jquery-ui-custom-pt_BR'), null, true);
// jQuery UI 1.8.4 CSS
wp_register_style('jquery-ui-custom-css', THEME_URL . 'css/smoothness/jquery-ui-1.8.4.custom.css');
wp_enqueue_style('jquery-ui-custom-css');
wp_enqueue_script('jquery-ui-custom');
And it worked but on other WP admin pages I got some jQuery errors because the overrides of jQuery (since it's loaded twice).
If I "deregister" the jQuery and register it again (using the latest) it won't work.
That's not the first time that I ran into this problem... All I need is to use the latest version of jQuery on my WordPress admin interface to use some features like Datepicker and Colorpicker.. But until now I can't do this using register_script
.
If I register it with "jquery" name, it won't update because there's already a jQuery loaded by WordPress on this line:
<script type='text/javascript' src='http://website.com/wp-admin/load-scripts.php?c=1&amp;load=jquery,utils,nav-menu&amp;ver=2b05c108d9016a4caa470b8edaf40953'></script>
And I can't hack into this load-scripts.php file to change the filename since I don't want to change the WordPress core.