Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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:

wp_register_script(),
wp_deregister_script(),
wp_enqueue_script(),
wp_dequeue_script()

share|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
add comment

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 );
share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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