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'd like to add something to wp_head() but I'm aiming precise location (like after style.css but before rtl.css and before my other custom script). I'm wondering if it's possible to list everything that is attached to wp_head() in execution/display order anyhow?

I know that I can pass priority/order parameter to add_action but I need to know what number will that be.

add_action( 'wp_head', 'my_function', 10 );

It all starts with 10 but somehow rtl.css seems to be always after style.css. Is it 11 maybe? How do I find that out?

share|improve this question
I found an answer :) For anyone wondering it's here: presscoders.com/2010/10/closeup-look-at-the-wp_head-action-hook - extremely useful piece of code. – Paul May 8 '13 at 17:11
up vote 3 down vote accepted

While you can practically control order of hooked things by priority, it's not always the right tool for the job.

In case of styles you should be using appropriate wp_enqueue_style() function which allows you to easily set up elaborate dependencies which will be automagically processed by WP to produce desired order of styles output.

Unfortunately while there is analogous wp_enqueue_scripts() for scripts, you cannot cross-depend scripts and styles like your question indicates. However it is common practice to not start JS execution until page has fully downloaded, so in most cases explicit depending on CSS should not be necessary.

share|improve this answer
Thanks! I was actually trying to create a <style> tag with user CSS. This can't be done with wp_enqueue_style unless a new CSS file is created. So, it's an exception :) – Paul May 9 '13 at 10:10

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.