首页 WordPress函数大全 add_action()

add_action()

2020-05-02 / 5078阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

add_action( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

挂钩功能>

Contents

  • Description
    • Parameters
    • Return
    • Source
    • Changelog
  • More Information
    • Usage
  • Related
    • Uses
    • Used By
  • User Contributed Notes

描述

动作是WordPress核心在执行期间或特定事件发生时在特定点启动的挂钩。插件可以指定>

参数

$tag

(string)
(Required)
The name of the action to which the $function_to_add is hooked.

$function_to_add

(callable)
(Required)
The name of the function you wish to be called.

$priority

(int)
(Optional)
Used to specify the order in which the functions associated with a particular action 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 action.

Default value: 10

$accepted_args

(int)
(Optional)
The number of arguments the function accepts.

Default value: 1

返回

(true) Will always return true.

大家谈论
    我的见解