remove_filter()删除一个过滤器的回调方法

目录

描述

译文

该函数移除一个附属于指定过滤器hook的函数。该方法可用来移除附属于特定过滤器hook的默认函数,并可能用其它函数取而代之。参见rremove_action(), add_filter()和add_action()。

重要:添加hook时的$function_to_remove 和$priority参数要能够相匹配,这样才可以移除hook。该原则也适用于过滤器和动作。移除失败时不进行警告提示。

原文

This function removes a function attached to a specified filter hook. This method can be used to remove default functions attached to a specific filter hook and possibly replace them with a substitute. See also remove_action(), add_filter() and add_action().

Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.

remove_filter() 描述

用法

<?php remove_filter$tag$function_to_remove$priority ); ?>

remove_filter() 用法

参数

$tag

(string) (必填) The action hook to which the function to be removed is hooked.

默认值: None

$function_to_remove

(callback) (必填) The callback for the function which should be removed.

默认值: None

$priority

(int) (可选) The priority of the function (as defined when the function was originally hooked).

默认值: 10

remove_filter() 参数

注意

When using 过滤器s passed with objects, you most often need to pass the exact same object back to the remove 过滤器 call, not just another instance of that object.(read _wp_filter_build_unique_id() for the gory details)

remove_filter() 注意

历史

  • 添加于 版本: 1.2.0

remove_filter() 历史

源文件

remove_filter() 函数的代码位于 wp-includes/plugin.php.

remove_filter() 源文件

相关