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> ';
	endforeach;
		
	echo 'STYLES<br>';
	foreach( $wp_styles->queue as $handle ) :
	echo $handle . ' <br> ';
	endforeach;	
}

Leave a Comment