The latest version of jquery ui core fixes a bug that's on my site. The problem is that Wordpress comes with an earlier version.

How do I override the default jquery ui core? One solution I've found is to edit the script-loader.php file in wordpress includes folder but I don't want to touch the WordPress core unless I have to.

Below is the core change that worked that I want to avoid.

$scripts->add( 'jquery-ui-core', '/wp-content/themes/themefolder/jquery.ui.core.min.js', array('jquery'), '1.9.2', 1 );
  • is it on the frontend or admin parts of your site? Mar 7 '13 at 6:51
  • the frontend of my site
    – Julian
    Mar 7 '13 at 7:10
  • Then you should contact the author of your theme before trying to solve it yourself Mar 7 '13 at 7:35

Add the following code in functions.php file of your theme that will remove default jquery ui core and will add your provided latest jquery ui core file from your theme.

function my_scripts_method() {  
    wp_deregister_script( 'jquery-ui-core' );
wp_enqueue_script('jquery-ui-core', get_stylesheet_directory_uri().'/jquery.ui.core.min.js', array('jquery'), '1.9.2', 1 );
add_action('wp_enqueue_scripts', 'my_scripts_method');

Tell me if it works for you or i provide you another solution...

  • didn't work when I try to replace two jquery ui scripts. function add_new_jquery_ui_core() { wp_deregister_script( 'jquery-ui-core' ); wp_enqueue_script('jquery-ui-core', '/wp-content/themes/lastwell/jquery.ui.core.min.js', array('jquery'), '1.9.2', 1 ); wp_deregister_script( 'jquery-ui-dialog' ); wp_enqueue_script('jquery-ui-dialog', '/wp-content/themes/lastwell/jquery.ui.dialog.min.js', array('jquery'), '1.9.2', 1 ); } add_action('wp_enqueue_scripts', 'add_new_jquery_ui_core');
    – Julian
    Mar 7 '13 at 7:06
  • got these two errors (1) Uncaught TypeError: Object function (e,t){return new v.fn.init(e,t,n)} has no method 'widget' jquery.ui.dialog.min.js:5 (2) Uncaught TypeError: Object [object Object] has no method 'dialog'
    – Julian
    Mar 7 '13 at 7:07
  • Is it working if you only enqueue jquery-ui-core js and not jquery-ui-dialog. Mar 7 '13 at 7:12
  • Dont use relative path instead use get_stylesheet_directory_uri() function. Mar 7 '13 at 7:14
  • I fixed it by added the correct dependencies for the dialog script. function add_new_jquery_ui_dialog() { wp_deregister_script( 'jquery-ui-dialog' ); wp_enqueue_script('jquery-ui-dialog', get_stylesheet_directory_uri() . '/jquery.ui.dialog.min.js', array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position'), '1.9.2', 1 ); }
    – Julian
    Mar 7 '13 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.