remove_action

函式
remove_action ( $hook_name, $callback, $priority = 10 )
引數
  • (string) $hook_name The action hook to which the function to be removed is hooked.
    Required:
  • (callable|string|array) $callback The name of the function which should be removed. This function can be called unconditionally to speculatively remove a callback that may or may not exist.
    Required:
  • (int) $priority Optional. The exact priority used when adding the original action callback. Default 10.
    Required:
    Default: 10
返回值
  • (bool) Whether the function is removed.
定義位置
相關方法
remove_all_actionsremove_accentsdo_actionremove_allowed_optionscurrent_action
引入
1.2.0
棄用
-

remove_action: 這個函式用來刪除一個已經用add_action函式新增到鉤子上的動作: 當你想刪除一個與你的外掛或主題產生衝突的動作時,這個函式很有用。

從一個動作鉤子上刪除一個回撥函式。

這可以用來移除附加在特定動作鉤子上的預設函式,並可能用一個替代品來替代它們。

要移除一個鉤子,`$callback`和`$priority`引數必須與鉤子被新增時相匹配。這對過濾器和動作都適用。移除失敗時不會有任何警告。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function remove_action( $hook_name, $callback, $priority = 10 ) {
return remove_filter( $hook_name, $callback, $priority );
}
function remove_action( $hook_name, $callback, $priority = 10 ) { return remove_filter( $hook_name, $callback, $priority ); }
function remove_action( $hook_name, $callback, $priority = 10 ) {
	return remove_filter( $hook_name, $callback, $priority );
}

常見問題

FAQs
檢視更多 >