Hooks & Shortcodes
Introduction
Hooks is a static wrapper over the WordPress hook functions. Using it instead of the globals keeps hook registration greppable and mockable in tests:
use YourPlugin\Deps\BitApps\WPKit\Hooks\Hooks;
Hooks::addAction('init', [$this, 'registerProviders'], 8);
Hooks::addFilter('the_content', [$this, 'appendNotice']);
Actions
Hooks::addAction($tag, $callback, $priority = 10, $acceptedArgs = 1);
Hooks::removeAction($tag, $callback, $priority = 10);
Hooks::doAction($tag, ...$args);
Filters
Hooks::addFilter($tag, $callback, $priority = 10, $acceptedArgs = 1);
Hooks::removeFilter($tag, $callback, $priority = 10);
Hooks::applyFilter($tag, $value, ...$args);
Your own extension points
Fire prefixed actions and filters so other plugins can extend yours without editing it. Prefix every tag with the plugin's variable prefix to avoid collisions:
Hooks::doAction(Config::withPrefix('loaded'));
$settings = Hooks::applyFilter(Config::withPrefix('default_settings'), $settings);
Register hooks from a provider under app/Providers, not from a controller — providers run at a predictable point in the lifecycle.
Shortcodes
Shortcode wraps the shortcode API the same way:
use YourPlugin\Deps\BitApps\WPKit\Shortcode\Shortcode;
Shortcode::add('your_plugin_form', [$renderer, 'render']);
The callback receives the shortcode attributes and returns markup — return it, never echo it, or the output lands in the wrong place on the page.
Shortcode output is inserted into post content, so escape everything you render (esc_html(), esc_attr(), wp_kses_post()). Attributes come from the post author and are not validated for you.