add_action( string $hook_name, callable $callback, int $priority = 10, int $accepted_args = 1 ): true

Adds a callback function to an action hook.

Description

Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Plugins can specify that one or more of its PHP functions are executed at these points, using the Action API.

Parameters

$hook_namestringrequired
The name of the action to add the callback to.
$callbackcallablerequired
The callback to be run when the action is called.
$priorityint