add_action
链接:https://developer.wordpress.org/reference/functions/add_action/
钩(hook)一个函数在一个特定的动作(action)
描述
Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur.
Plugins can specify that one or more of its PHP functions are executed at these points, using the Action API.
动作(Actions)是WordPress核心在执行期间或特定事件发生时在特定点启动的挂钩。
插件可以使用Action API指定在这些位置执行其一个或多个PHP函数。
do_action
链接:https://developer.wordpress.org/reference/functions/do_action/
Execute functions hooked on a specific action hook.
执行函数 钩在一个特定的动作钩子上
参考阅读:apply_filters(创建过滤器) add_filter(添加过滤器)
do_action( string $tag, mixed $arg ) |
Parameters |
$tag (string) (Required) The name of the action to be executed. $arg (mixed) (Optional) Additional arguments which are passed on to the functions hooked to the action. Default empty. |