How to include jquery-ui library in WordPress?

jquery is enqueued by default on admin side. So, it may not be loading due to your wp_enqueue_script statement.
Are you using wp_enqueue_script inside some action hook? Because you have to. I use it like this:

add_action( 'admin_enqueue_scripts-options_page-{page}', 'myplugin_admin_scripts' );
function myplugin_admin_scripts() {
    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-core');
} 

Leave a Comment