[WordPress] 外掛分享: WPVN Unload Hooks

首頁外掛目錄 › WPVN Unload Hooks
全新外掛
安裝啟用
尚無評分
6155 天前
最後更新
問題解決
WordPress 2.0+ v0.9.2 上架:2009-04-21

內容簡介

這個外掛是給進階使用者使用的。

如何使用?

您只需要啟用這個外掛,這個版本沒有任何改變。現在您可以使用兩個額外的功能:cr_hook_remove($hooks_to_find = array(), $exact = false, $display = true, $detail = false) cr_hook_list($hookname = array(), $display = true, $detail = false) {

這些功能對於動作/actions或過濾器/filters的名稱是大小寫敏感的。

要移除動作/actions或過濾器/filters(cr_hook_remove)的功能,您應該在該動作/actions或過濾器/filters被載入之前呼叫該函數,否則您將無法刪除它。最好的方法是在主題的 functions.php 中使用,或者更好的方法是直接在外掛檔案 'wpvn-unload-hooks.php' 中使用。(請注意,在外掛檔案中呼叫該功能應該不會顯示任何輸出,否則您會混亂 Response HTTP header)。這個函數可用於顯示鉤子和已加入的動作/actions或過濾器/filters,您可以在任何地方呼叫。

範例

cr_hook_list(); 顯示所有動作/actions或過濾器/filters。 cr_hook_list('wp_head');顯示已加入到'wp_head'的動作/actions或過濾器/filters。cr_hook_remove();無效。 cr_hook_remove('AJAX');將刪除所有具有該字符串的名稱的動作/actions或過濾器/filters。cr_hook_remove('AJAX', true);將刪除所有名稱為' AJAX '的動作/actions或過濾器/filters。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.9.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WPVN Unload Hooks」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin is destined to advanced users.
How to use?
You just need to activate the plugin. Nothing changes for this release. You have now two additional functions: cr_hook_remove($hooks_to_find = array(), $exact = false, $display = true, $detail = false) cr_hook_list($hookname = array(), $display = true, $detail = false) {
These functions are case-sensitive for actions/filters’ names.
The function to remove actions/filters (cr_hook_remove) you should call before the hooked is made, or you cannot remove it. The best place is in functions.php of the theme, or even better, directly in the plugin file ‘wpvn-unload-hooks.php’. (Be aware that calling in the plugin file should not print any output or you will mess up with Response HTTP header). The function to list hooks and hooked actions/filters, you can call anywhere you want.
Example
cr_hook_list(); shows you everything. cr_hook_list(‘wp_head’); shows you actions/filters that are hooked to ‘wp_head’ cr_hook_remove(); nothing happens, lose your time. cr_hook_remove(‘AJAX’); All actions/filters have that string in their names will be removed. cr_hook_remove(‘AJAX’, true); All actions/filters have the exact name ‘AJAX’ will be removed.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon