Skip to content

Instantly share code, notes, and snippets.

@yanknudtskov
Created June 29, 2020 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yanknudtskov/557e967a0ee1e643edfb53a2df1e6480 to your computer and use it in GitHub Desktop.
Save yanknudtskov/557e967a0ee1e643edfb53a2df1e6480 to your computer and use it in GitHub Desktop.
List all enqueued scripts and styles
<?php
function yanco_list_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2><ul>";
foreach( $wp_styles->queue as $handle ) :
echo "<li>" . $handle . "</li>";
endforeach;
echo "</ul>";
}
if( !is_admin() ) add_action( 'wp_print_styles', 'yanco_list_styles' );
function yanco_list_scripts() {
global $wp_scripts;
echo "<h2>Enqueued JS Scripts</h2><ul>";
foreach( $wp_scripts->queue as $handle ) :
echo "<li>" . $handle . "</li>";
endforeach;
echo "</ul>";
}
if( !is_admin() ) add_action( 'wp_print_scripts', 'yanco_list_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment