After the solution to this question was to get a function to launch BEFORE the init action is fired by taking the sequence out of its function, it got me thinking, is there any earlier in the WP load sequence that I can hook a function into?

  • I really wish they would have added a plugin call before the whole system was loaded. – Xeoncross Jan 22 '12 at 4:00

muplugins_loaded is the earliest hook.

Depending on your wordpress setup, you may not have any plugins in the MU_PLUGINS directory. In that case this hook may not fire.

The next best hook to trigger is plugins_loaded.


  1. WordPress Codex - Action Reference List
  2. Q/A: How to get WordPress' hook run sequence?
  3. Q/A: Make sense of WP Load Core
  • 8
    Yep, but note that it runs before loading of normal plugins and theme so it is somewhat useless in practice. plugins_loaded and after_setup_theme are earliest appropriate for normal plugins and theme accordingly. – Rarst Jul 21 '11 at 11:09
  • answer updated. check desired action with "Hooks run list". – T.Todua Jul 10 '15 at 15:10
  • 2
    This answer contains some very bad information. The muplugins_loaded action is not conditional on anything . It will fire. If there are no mu-plugins, though, I am not sure how you'd get code to run before early enough to use the hook. – s_ha_dum Jan 10 '16 at 15:08

For anyone interested in finding this out on your own, there is an awesome plugin named Query Monitor.

Install and activate the plugin (on staging or dev install obviously) and just select what you want from the drop down.

enter image description here

| improve this answer | |

As mentioned in a comment on the accepted answer, the hook muplugins_loaded is not conditional. If you read the source code you will find that it is always fired - at least in recent versions of WordPress. According to the documentation it is also the first available hook. However, unless you are actually writing a must-use or network activated plugin it doesn't make much sense to use it since it will fire before your plugin or theme is loaded.

If you are writing a plugin, then the plugins_loaded is the first general action hook to use.

If you are adding code to your theme's functions.php, then you could use after_setup_theme.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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