WPDev.one
Core Function
View Source on Trac ↗

has_filter()

has_filter( mixed $hook_name, mixed $callback = false )

Checks if any filter has been registered for a hook.

Parameters 2 required

Name / Type Description
$hook_name
string

The name of the filter hook.

Required
mixed

(callable | string | array | false) $callback Optional. The callback to check for. This function can be called unconditionally to speculatively check a callback that may or may not exist. Default false.

Required

Return Value

((bool)
(bool | int) If `$callback` is omitted, returns boolean for whether the hook has anything registered. When checking a specific function, the priority of that hook is returned, or false if the function is not attached.

Function Information

Since Version
2.5.0
Source File
wp-includes/plugin.php
Advertisement