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

I'm creating a theme where i want it to have different widgets and plugins. Each plugin would ideally have it's own css file. However, this approach is not so good because i can end up having multiple files included in my header.

Is there an approach where i can sort of cache all different css files in a single one upon the first user request and then just use that ?

share|improve this question
up vote 4 down vote accepted

Yes: put them all in a function, and then enqueue that function at the wp_enqueue_scripts hook. That way, you can define the CSS dynamically (e.g. based on Theme option settings), and let WordPress output it in the document head.

share|improve this answer
+1 That sounds interesting, but it would still load different css files right ? Is it possible to load a single one using that or an altered technique? – SpyrosP Jun 24 '11 at 18:51
No; it would just output multiple <script> calls in the document head. – Chip Bennett Jun 24 '11 at 20:11

W3 Total Cache is your friend. It has the ability to combine and concatenate js/css files out of the box. You'll have to do some manual configuration, but the pros outweigh the cons.

share|improve this answer

WP Minify does the job quite well too. Little easier to configure than W3TC and integrates nicely with WP Super Cache if you're already using it.

share|improve this answer

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.