Skip to content

Instantly share code, notes, and snippets.

@smutek
Created June 15, 2015 15:17
Show Gist options
  • Save smutek/4f050a81260c4b32e9cc to your computer and use it in GitHub Desktop.
Save smutek/4f050a81260c4b32e9cc to your computer and use it in GitHub Desktop.
lists handles for all enqueued styles and scripts
/*
* Lists out the handles for all enqueued styles and scripts.
* Credit: http://wordpress.stackexchange.com/questions/54064/how-do-i-get-the-handle-for-all-enqueued-scripts
*/
function wp_inspect_scripts() {
global $wp_scripts;
echo '<pre><h1>Script Handles</h1><ul>';
foreach( $wp_scripts->queue as $handle ) :
echo '<li>' . $handle . '</li>';
endforeach;
echo '</ul></pre>';
}
add_action( 'wp_print_scripts', 'wp_inspect_scripts' );
function wp_inspect_styles() {
global $wp_styles;
echo '<pre><h1>Style Handles</h1><ul>';
foreach( $wp_styles->queue as $handle ) :
echo '<li>' . $handle . '</li>';
endforeach;
echo '</ul></pre>';
}
add_action( 'wp_print_styles', 'wp_inspect_styles' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment