WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Where can I get the list of styles about to be printed? What i want is to either filter the list, doing what i want with each, then return empty list. Or do an action that recieves the list, then i can remove_action the print_styles. Something like that, anyway. I'm creating a css minifier concatenizer.

share|improve this question
up vote 2 down vote accepted

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.


global $wp_styles;

if ( is_a( $wp_styles, 'WP_Styles' ) )
    print_r( $wp_styles->queue );
    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
share|improve this answer
Beauty. Also, for realted searches, the $wp_scripts works in the same way. So, for concatenizing and minifying purposes, it looks like I can simply go thru the $wp-styles->enqued array, do the concat/min on those files and then swap out my resulting min.css in the ->registered and ->enqued arrays. Problems or thoughts? – Doug Cassidy Oct 21 '12 at 18:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.