Show All Loaded Scripts and Styles on a Page in WordPress

To show all loaded scripts and styles on a page in WordPress you can use a foreach loop and show the name of the script as referred to as a $handle

add_action( 'wp_print_scripts', 'prefix_show_me_the_scripts' );
* Show what Scripts and Styles are running on a page
function prefix_show_me_the_scripts() {
	global $wp_scripts;
	global $wp_styles;

	echo 'SCRIPTS<br>';
	foreach( $wp_scripts->queue as $handle ) :
        echo $handle . ' <br> ';
	echo 'STYLES<br>';
	foreach( $wp_styles->queue as $handle ) :
	echo $handle . ' <br> ';

1 Comment

  1. Bradley Pirman on October 29, 2019 at 8:05 pm

    Thanks, this post was direct and to the point. The code worked well in my development environment. Cheers!

Leave all Comment