Filter all the things

Filters aren’t just for WP core. They’re for you too!

If you’re building anything for the WordPress product space, you should plan your code to support filters and actions for almost all of its internal data, logic and output. Hooks are the life blood of a healthy extensible product.

Why? You know that relief you feel when you find a WordPress hook in exactly the place you need to do what you want. Give that gift to someone else.

As a side benefit, it will totally streamline your support. Being able to tell someone “there’s a hook for that” and write an addon in 2 minutes to solve their problem will save you tons of time while providing support.

Here are some ideas for useful filters:

  • Filter front-end output so that people can append their own data to it.
  • Build output from callback arrays for maximum flexibility.
  • Add escape clauses to protected information or data
  • Filter custom post type arguments
  • Filter post data and post metadata when adding it to the database