返回介绍

has_action()

发布于 2017-09-11 00:48:58 字数 2373 浏览 1166 评论 0 收藏 0

has_action( string $tag,  callable|bool $function_to_check = false )

Check if any action has been registered for a hook.


description


参数

$tag

(string) (Required) The name of the action hook.

$function_to_check

(callable|bool) (Optional) The callback to check for.

Default value: false


返回值

(bool|int) If $function_to_check 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. When using the $function_to_check argument, this function may return a non-boolean value that evaluates to false (e.g.) 0, so use the === operator for testing the return value.


源代码

File: wp-includes/plugin.php

function has_action($tag, $function_to_check = false) {
	return has_filter($tag, $function_to_check);
}

更新日志

Versiondescription
2.5.0Introduced.

相关函数

Uses

  • wp-includes/plugin.php: has_filter()

Used By

  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::save_changeset_post()
  • wp-includes/plugin.php: do_action_deprecated()
  • wp-admin/includes/class-wp-screen.php: WP_Screen::render_meta_boxes_preferences()
  • wp-admin/install.php: display_setup_form()
  • wp-admin/includes/plugin.php: get_plugin_page_hook()
  • wp-includes/functions.php: do_feed()
  • wp-includes/class-wp-customize-setting.php: WP_Customize_Setting::preview()
  • wp-includes/class-wp-customize-setting.php: WP_Customize_Setting::update()
  • Show 3 more used by Hide more used by

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文