has_action()
最后更新于:2021-11-27 04:36:26
has_action( string$hook_name, callable|false$callback=false)Checks if any action has been registered for a hook.
参数
- $hook_name
-
(string) (Required) The name of the action hook.
- $callback
-
(callable|false) (Optional) The callback to check for.
Default value: false
响应
(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.
源文件
文件: gc-includes/plugin.php
function has_action( $hook_name, $callback = false ) {
return has_filter( $hook_name, $callback );
}