13

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 1

29

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

1
  • 2
    Just 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
    – Eray
    Mar 31, 2015 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.