A basic primer for WordPress Hooks, Actions, and Filters. If you are getting started with WordPress and have basic PHP knowledge, these examples are a quick demonstration of how to extend and expand upon WordPress for your sites and your clients.
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
WHY USE HOOKS?
▸ Most WordPress features use actions and filters that you can
modify to change how WordPress fundamentally works
▸ You can make complex changes easily without editing core,
or existing plugins or themes that you’ve purchased
▸ Make changes at the source, instead of hacking away
▸ Upgrade without worry of losing your modifications
▸ Enable and disable your changes easily
obm.io/php2015-hooks
Hooks: Places where you
can add your own code.
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
obm.io/php2015-hooks
Mr. WordPress
HOW A HOOK IS BORN
I’m going to do this thing.
Before you do your thing, I’ve got this other
thing that I want to do.
Mr. WordPress
Ms. Plugin
Ok, do your thing, then I’ll do my thing!
obm.io/php2015-hooks
Actions: Hooks that let
you do something when
something else happens
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
obm.io/php2015-hooks
Filters: Hooks that let you
modify data before or
after interacting with the
WordPress database
HOOKS, ACTIONS, AND FILTERS OH MY! @DAVIDLAIETTA
obm.io/php2015-hooks