#[Hook]

Attribute on methods, repeatable.

use Saij\WpAppFramework\Hook\Hook;

Registers a public method of a service as a WordPress action or filter.

A method with return type void becomes an action, any other return type a filter. Parameters whose type is a service candidate are injected; all other parameters receive the arguments passed by WordPress, in their order.

Arguments

#[Hook(string $name, int $priority = 10)]
ParameterTypeDefaultDescription
namestringrequiredName of the action or filter, e.g. the_title.
priorityint10Priority of the callback; lower numbers run earlier.