Hooks are WordPress developer options

A metaphor

If I, a “player developer”, was asked to develop a custom “tennis player” I would figure my job ending with a guy in a shirt, wearing shorts, an headband and a racket in hand and with a knowledge of tennis rules.
If i delivered a human being to the court that needs to be dressed like a tennis player , be given a a racket and taught the rules each time then my job, while “done”, would not be “well done” because I would be needed at least once before each match.
The metaphor ends replacing “player” with “site” and “tennis” with “custom” and all the equipment and rule knowledge with “content types, relations and taxonomies”.
Any change and addition I make to the player on the court is a change I make on the site in the database and is not part of the initial state of the site.

My work is before the match

If I want to do a good job to deliver a custom theme and plugin package for a site I then need to be able to “build a tennis player” before he sets foot in the court; I need some hook to customize the final product.
This is a first revelation of mine that I’ve not seen stated enough: as a plugin or theme developer my job is to set a site to match the client specs before any field adaptation (read “database persisted customization”) happens.

Hooks are there already sometimes

While WordPress is loaded with hooks not many plugins, and among those I list all the ones I’ve developed until now, do. That’s comprehensible in a WordPress environment where the border between developers, designers and hacking users is a paper thin and often non-existent one. As a more mature developer than a I was about a year ago I now look for simple plugins offering hooks in the form of actions and filters to solve my problems rather than UI rich ones that will allow me to manage options (read “on the court customization”) from an administration panel.

The making of a tennis player

Once I’m able to work on a player before the match then I need to make a player of him and do that each time consistently. In WordPress terms this means I have to hook into actions and filters and set a site initial state, or part of it, in the code. This is exemplified by the usage of a plugin like Posts 2 Posts: relations are set in the code using an action hook.

The gotcha

I’ve come to understand that almost all the times the easiest way to customize a site behavior to match a client specific needs in a way that’s consistent and easy to maintain is to write themes or plugins that will hook into WordPress core or other themes and plugins.
One of the strongest ideas I’ve come to appreciate is that if I want a site I’ve made to be easy to maintain and use then I have to build it as if it was to be deployed a thousand time each time identical to itself and each time not requiring my intervention.