Return to main site

All active snippets are executed on the plugins_loaded hook. That means that they will run as soon as all of the active plugins have been loaded into the site.

Here's where that takes place in relation to a number of other common WordPress actions:

  1. muplugins_loaded – all must-use plugins are loaded.
  2. plugins_loaded – all active plugins are loaded.
  3. all active snippets are loaded.
  4. setup_theme – just before the current theme is loaded.
  5. current theme's functions.php file is evaluated.
  6. after_setup_theme – just after the current theme is loaded.
  7. set_current_user – the userdata for the currently logged-in person is set up.
  8. init – most of WordPress has loaded; just before the page's content is sent to the browser.
  9. wp_loaded – WordPress has been fully loaded.
  10. pre_get_posts – just before the active query is run (front-end only).
  11. wp – WordPress environment has been fully set up.

If you want to delay your snippet to run on a later hook, you can do so using the add_action function. Here's an example:

add_action( 'init', function () {

	// snippet code goes here

} );