Event Manager
WP Headless extends DownShift's WordPress event emitter with a event manager wrapper.
Adding actions and filters is very similar to working with WordPress' native hook system API.
use SB2Media\Headless\Events\EventManager;
...
EventManager::addAction('event-hook', [$this, 'callbackMethod'], $priority_num, $accepted_args_num);
EventManager::addFilter('filter-name', [$this, 'callbackMethod'], $priority_num, $accepted_args_num);
Events can also be removed with the removeAction()
method.
EventManager::removeAction('event-hook', [$this, 'callbackMethod'], $priority_num, $accepted_args_num);