Listing registered scripts

There’s a global variable called $wp_scripts which is an instance of the WP_Scripts class. It doesn’t have a public API for looking at registered or enqueued scripts, but you can look inside the object and see what’s going on.

You can see all the registered scripts with:

global $wp_scripts;
var_dump( $wp_scripts->registered );

To see the enqueued scripts:

global $wp_scripts;
var_dump( $wp_scripts->queue );

You’ll want to run this after all your plugins & theme have had a chance to register their scripts. Maybe as part of a wp_footer handler.

Bear in mind, of course, these are implementation details & not a real API. They could change at any moment in the future. But if you’re just debugging for now, you’re probably ok.

Leave a Comment