Recent

Hook_Registry class

Hook_Registry

Hook Registry class for managing WordPress actions and filters.

Namespace: WebberZone\Link_Warnings\Util
Since: 1.0.0
Source: includes/util/class-hook-registry.php line 19

Methods

register() static

Register a hook (action or filter).

Line: 39

static public function register( string $hook_type, string $hook_name, callable $callback, int $priority = ..., int $args = ... ): bool;
TypeNameDescription
string$hook_typeEither ‘action’ or ‘filter’.
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.
int$argsNumber of arguments.

Returns: bool — True if registered, false if duplicate or invalid hook.

add_action() static

Register an action.

Line: 94

static public function add_action( $hook_name, $callback, $priority = ..., $args = ... ): bool;
TypeNameDescription
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.
int$argsNumber of arguments.

Returns: bool — True if registered, false if duplicate or invalid hook.

add_filter() static

Register a filter.

Line: 108

static public function add_filter( $hook_name, $callback, $priority = ..., $args = ... ): bool;
TypeNameDescription
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.
int$argsNumber of arguments.

Returns: bool — True if registered, false if duplicate or invalid hook.

remove() static

Remove a hook (action or filter).

Note: Closures are removable only if registered via this class.

Line: 124

static public function remove( $hook_type, $hook_name, $callback, $priority = ... ): bool;
TypeNameDescription
string$hook_typeEither ‘action’ or ‘filter’.
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.

Returns: bool — True if removed, false if not found or removal failed.

remove_action() static

Remove an action.

Line: 168

static public function remove_action( $hook_name, $callback, $priority = ... ): bool;
TypeNameDescription
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.

Returns: bool — True if removed, false if not found or removal failed.

remove_filter() static

Remove a filter.

Line: 181

static public function remove_filter( $hook_name, $callback, $priority = ... ): bool;
TypeNameDescription
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.

Returns: bool — True if removed, false if not found or removal failed.

get_hooks() static

Get all registered hooks.

Line: 190

static public function get_hooks(  ): array;

Returns: array — Array of registered hooks.

remove_all_hooks() static

Remove all registered hooks.

Line: 199

static public function remove_all_hooks(  ): void;

Returns: void

create_hook_key() static

Create a unique key for a hook registration.

Line: 220

static public function create_hook_key( $hook_name, $callback, $priority, $closure_id = ... ): string;
TypeNameDescription
string$hook_nameThe hook name.
callable$callbackThe callback function.
int$priorityPriority of the hook.
string$closure_idUnique ID for closures.

Returns: string — Unique key.

callback_to_string() static

Convert a callback to a string representation.

Line: 231

static public function callback_to_string( $callback ): string;
TypeNameDescription
callable$callbackThe callback to convert.

Returns: string — String representation of the callback.