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. |