has_action()判断一个动作钩子是否注册了某个回调方法

目录

描述

Check if any action has been registered for a hook.

has_action() 描述

用法

<?php has_action$tag$function_to_check ?>

has_action() 用法

参数

$tag

(string) (必填) The name of the action hook.

默认值: None

$function_to_check

(callback) (可选) If specified, return the priority of that function on this hook or false if not attached.

默认值: false

has_action() 参数

返回值

(integer|boolean) 

Optionally returns the priority on that hook for the specified function.

has_action() 返回值

注意

  • See has_filter() has_action is an alias of has_filter().
  • Since this 动作 is an alias of has_filter() it also uses the global array $wp_filter that stores all of the 过滤器s / 动作s.

has_action() 注意

历史

添加于 版本: 2.5

has_action() 历史

源文件

has_action() 函数的代码位于 wp-includes/plugin.php.

has_action() 源文件

相关