The following block of code returns a list of enqueued & registered styles.
function mg_print_styles() {
global $wp_styles;
foreach( $wp_styles->queue as $handle ) :
echo '<div>Style <br />';
echo "Handle: " . $handle . '<br />';
echo "URL: " . $wp_styles->registered[$handle]->src;
echo '</div>';
endforeach;
}
add_action( 'wp_print_scripts', 'mg_print_styles', 101 );
It does not however display the handle of a style enqueued/registered by a plugin e.g. abc
. Using, wp_style_is
returns true.
$style = 'abc';
echo wp_style_is ( $style );
Additionally, it also returns an echoed value. enqueued
, queue
and registered
all result in an output.
if ( wp_style_is ( $style , 'enqueued') ) {
echo $style . " " . $list;
}