February 20, 2016
Hooks are one thing which intermediate programmers struggle with the most. Mastering actions and filters will elevate intermediate developers to advanced ones. However, much of the documentation about hooks are hard to understand, and the standard examples are insufficient. I’m a big fan of putting a different spin on lectures and using analogies which no one else has in order to make things more understandable. I explain the difference between the two by drawing a parallel to a shopping trip. Filters are when my wife calls me to ask me to pick something new up from the store I’m going to; actions are when she asks me to go to a completely different store. I then go into how to use hooks from a developer side – add_action and add_filter – as well as how to use them from a “builder” side – apply_filters and do_action.