-
-
Save onwp/eb47dfac05578319c2e8a74f4c98ae3f to your computer and use it in GitHub Desktop.
WordPress inspect styles and scripts
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 inspect_scripts() { | |
if (!is_admin()) { | |
global $wp_scripts, $wp_styles; | |
echo '<h1>Scripts</h1>'; | |
echo '<ol>'; | |
foreach( $wp_scripts->queue as $handle ) : | |
echo '<li>' . $handle . '</li>'; | |
endforeach; | |
echo '</ol>'; | |
echo '<hr/>'; | |
echo '<h1>Styles</h1>'; | |
echo '<ol>'; | |
foreach( $wp_styles->queue as $handle ) : | |
echo '<li>' . $handle . '</li>'; | |
endforeach; | |
echo '</ol>'; | |
} | |
} | |
add_action( 'wp_print_scripts', 'inspect_scripts', PHP_INT_MAX ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment