Skip to content

Instantly share code, notes, and snippets.

@salvatorifabio77
Created September 11, 2018 15:33
Show Gist options
  • Save salvatorifabio77/4a7fe058a58a0a6222bbdc8b85e436a0 to your computer and use it in GitHub Desktop.
Save salvatorifabio77/4a7fe058a58a0a6222bbdc8b85e436a0 to your computer and use it in GitHub Desktop.
add_action( 'wp_print_scripts', '_list_enqueued_scripts_and_styles' );
function _list_enqueued_scripts_and_styles() {
global $wp_scripts, $wp_styles;
$scripts_list = '';
$styles_list = '';
// Runs through the queue scripts
foreach( $wp_scripts->queue as $handle ) :
$scripts_list .= $handle.' - '.$wp_scripts->registered[$handle]->src . ' <br> ';
endforeach;
// Runs through the queue styles
foreach( $wp_styles->queue as $handle ) :
$styles_list .= $handle.' - '.$wp_styles->registered[$handle]->src . ' <br> ';
endforeach;
echo '<div class="wp-scripts"><h3>Scripts:</h3> '.$scripts_list.'</div>';
echo '<div class="wp-styles"><h3>Styles:</h3> '.$styles_list.'</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment