Created
June 29, 2020 14:59
-
-
Save yanknudtskov/557e967a0ee1e643edfb53a2df1e6480 to your computer and use it in GitHub Desktop.
List all enqueued scripts and styles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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