hellonico / wp-early-hooks
This package is abandoned and no longer maintained.
The author suggests using the wecodemore/wordpress-early-hook package instead.
Add filters and actions before WordPress hooks functions are available
0.1.0
2022-09-19 10:29 UTC
Requires (Dev)
README
Add filters and actions (add_filter
and add_action
) before anything in WordPress has even started (such as advanced-cache hooks) thanks to the WP_Hook::build_preinitialized_hooks
method which normalizes raw shaped hooks (e.g. an array stored in $GLOBALS['wp_filter']
).
Usage
This package exposes two functions with the same signature than add_filter
and add_action
:
function add_filter_early($hook_name, $callback, $priority = 10, $accepted_args = 1);
function add_action_early($hook_name, $callback, $priority = 10, $accepted_args = 1);