WordPress:Function Reference/remove filter

来自站长百科
Fludlen讨论 | 贡献2008年7月21日 (一) 15:09的版本
跳转至: 导航、​ 搜索

Description

描述

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

这个函数移除了附加在某个filter hook上的函数。这种方法可以用来移除附加在某个filter hook上的默认函数,同时可以将这些默认函数替换为另一个函数。也看看remove_action(), add_filter()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.

重点:要移除hook,添加hook时,$function_to_remove$priority参数必须匹配。这也同样适用于filters和actions。移除操作失败,不会给通知。

Example

例子

This function is identical to the remove_action() function.

<?php remove_filter($tag, $function_to_remove, $priority, $accepted_args); ?>

这个函数与remove_action()函数是相同的。 <?php remove_filter($tag, $function_to_remove, $priority, $accepted_args); ?>

Parameters

参数

Return

返回

(boolean) Whether the function is removed.

(boolean) 函数是否被移除。

True
The function was successfully removed.
False
The function could not be removed.
True
函数被成功地移除了。
False
函数没有被移除。