Use WP init hook to call other hooks?

Posted by Prem Tiwari | Updated on

Use WP init hook to call other hooks?

In general: Yes, wait for a dedicated hook to start your own code. Never just throw an object instance into the global namespace. But init is rarely necessary.

You hook in as late as possible. If your first code runs on wp_head do not use an earlier hook. You can even cascade hooks:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers