wp_head() – list hooked actions with priorities?

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.

Read More
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?

Related posts

1 comment

  1. 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.

Comments are closed.