add_action(), add_filter() before or after function

Posted by Prem Tiwari | Updated on

It is easier to read: When is what called? If you are debugging a hook you can immediately see if you have to read the function or not: If it is not your hook, you can skip the code.

In my themes and plugins I combine all registrations for actions, filters and shortcodes at the top and I add the hook to the PHPDoc block:

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

Related Questions & Answers