I’ve posted before about using hooks in WordPress. I think it would be good to write a more advanced post on the topic, including things such as:
- Why you usually shouldn’t use anonymous functions (aka “Closures”) attached to hooks
- Why you sometimes should use anonymous functions attached to hooks
- Best practices for using hooks with class objects
Somewhat related was an article I read recently: https://inpsyde.com/en/remove-wordpress-hooks/
Sal Ferrarello says
These code examples from Brady Vercher may also be relevant in fleshing out this post, https://github.com/bradyvercher/wp-hook-examples.