How do I get the $handle for all enqueued scripts?

Is there some way to get the $handle for each script that has been enqueued?

Is there some array that holds all the handles so that I can loop through it and do something using each $handle?

2

the $wp_scripts global holds all the script data:

function wpa54064_inspect_scripts() {
    global $wp_scripts;
    foreach( $wp_scripts->queue as $handle ) :
        echo $handle;
    endforeach;
}
add_action( 'wp_print_scripts', 'wpa54064_inspect_scripts' );

Leave a Comment