wp-includes/class-wp-hook.php:26Core class used to implement action and filter hook functionality.
$callbacksarraypublic$prioritieslist<int>protected$iterationsarray<int,private$current_priorityarray<int,private$nesting_levelintprivate$doing_actionboolprivate#[AllowDynamicProperties]final class WP_Hook implements Iterator, ArrayAccess { /** * Hook callbacks keyed by priority. * * @since 4.7.0 * @var array * @phpstan-var array<int, array<string, Hook_Callback>> */ public $callbacks = array(); /** * Priorities list. * * @since 6.4.0 * @var list<int> */ protected $priorities = array(); /** * The priority keys of actively running iterations of a hook. * * @since 4.7.0 * @var array<int, list<int>> */ private $iterations = array(); /** * The current priority of actively running iterations of a hook. * * @since 4.7.0 * @var array<int, int> */ private $current_priority = array(); /** * Number of levels this hook can be recursively called. * * @since 4.7.0 * @var int */ private $nesting_level = 0; /** * Flag for if we're currently doing an action, rather than a filter. * * @since 4.7.0 * @var bool */ private $doing_action = false; /** * Adds a callback function to a filter hook. * * @since 4.7.0 * * @param string $hook_name The name of the filter to add the callback to. * @param callable $callback The callback to be run when the filter is applied. * @param int $priority The order in which the functions associated with a particular filter * are executed. Lower numbers correspond with earlier execution, * and functions with the same priority are executed in the order * in which they were added to the filter. * @param int $accepted_args The number of arguments the function accepts. */ public function add_filter( $hook_name, $callback, $priority, $accepted_args ) { if ( null === $priority ) { $priority = 0; } $idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority ); if ( null === $idx ) { return; } $priority_existed = isset( $this->callbacks[ $priority ] ); $this->callbacks[ $priority ][ $idx ] = array( 'function' => $callback, 'accepted_args' => (int) $accepted_args,Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/class-wp-hook.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.