I can’t tell you how many times I’ve had to look back and establish the process in my mind when building plugins or themes. I’ve done it so many times that you’d think I’d just remember it but I don’t — I always have to go spend a few minutes reminding myself. So, here’s a very quick reference for me (and maybe you!) to look back on when in need…
plugins_loaded hook fires
setup_theme hook fires
The theme’s functions.php file is included in wp-settings.php. If using a child theme, the child theme is loaded first.
after_setup_theme hook fires
init hook fires
wp_loaded hook fires
wp() function is invoked in wp-blog-header.php
wp hook fires
The wp-includes/template-loader.php file is included in wp-blog-header.php
template_redirect hook fires
If you liked this article, I'd be incredibly grateful if you tweeted about it.
Also, I don't send emails often but when I do, I try to fill them full of useful goodies. If you like code snippets & dev tips, join my mailing list. There's no catch but I'll probably want to tell you about any new plugins & tools I build.