What is the difference between the after_setup_theme
and init
action hooks? It seems they are both called right before any page in WordPress is loaded (even admin pages).
1 Answer
after_setup_theme
action hook is fired before the actual $wp->init();
which Set up the current user and only then init
action hook is fired which means that they are pretty much the same with one major difference and that is at after_setup_theme
the user is not authenticated, and at init
he is (assuming that we are talking about an actual user).
-
2Just an addition to Bainternet's great answer. You can see execution order of hooks in here : codex.wordpress.org/Plugin_API/Action_Reference . And you can see all hooks and differences between after_setup_theme and init– ErayCommented Mar 31, 2015 at 3:30