Whilst jQuery is available on all admin pages, only selected jQuery UI libraries are added for certain pages (i.e. it is different for each admin page).

I am trying to find out where the jQuery UI libraries are actually registered for each admin page. For instance the widgets.php page has draggable, droppable added.


The core file for this is in wp-includes/script-loader.php for reference, but if you want to alter them use the built in script functions such as:


| improve this answer | |
  • Yeah, I've looked through that core file. It seems to setup all the default scripts and handles into one class instance. Each admin page has a different subset of these jQuery UI loaded, so I'm looking for where these are actually set for each admin page. – dgwyer Jan 9 '12 at 0:48

As an addition to @Wyck answer, you can take a look at this explanation about how to determine on which admin UI page you currently are.

Most of the scripts are already registered, but not enqueued, so not loaded. Just inspect them in the shutdown through dumping the $GLOBALS['wp_scripts'];.

You can use the following function that hooks into this hook:

function debug_my_scripts()
    global $wp_scripts;

    $output['Registered']  = var_export( array_keys( $wp_scripts->registered ), true );
    $output['Enqueued'] = var_export( $wp_scripts->queue, true );
    $output['Done'] = var_export( $wp_scripts->done, true );

    foreach ( $output as $title => $data )
        print "<h3>{$title}</h3><pre>{$data}</pre>";
if ( is_admin() )
    add_action( 'shutdown', 'debug_my_scripts', 9999 );
| improve this answer | |
  • I'm already outputting the global $wp_scripts earlier than shutdown to inspect the libraries being added (as well as inspecting the source). I just wanted to find out what scripts were being enqueued in the core, and where. This is actually being done by dependencies in most cases rather than direct enqueues. – dgwyer Jan 10 '12 at 8:28
  • Yea, but earlier might be too early, as the shutdown hook runs close after admin_* hooks which are used to add scripts to the bottom of the pages body. So inspecting at shutdown is what you normally should go for. If you want to know what core adds, just add a theme that contains nothing than an empty style.css and a functions.php file with the function shown in my answer and you're fine - don't forget to turn off all your plugins. – kaiser Jan 10 '12 at 13:27

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.