Get list of registered or enqued styles? looking for filters or actions

There is a global variable named $wp_styles. It is a WP_Styles object (if it exists at all) and it holds all the enqueued styles in a public variable $queue.

Untested:

global $wp_styles;

if ( is_a( $wp_styles, 'WP_Styles' ) )
{
    print_r( $wp_styles->queue );
}
else
{
    print 'no styles enqueued';
}

Make sure you test that after the init hook, because stylesheets should not be enqueued earlier.

For details see:

  • /wp-includes/functions.wp-styles.php,
  • /wp-includes/class.wp-styles.php and
  • /wp-includes/class.wp-dependencies.php

Leave a Comment