WordPress: Function Reference/remove filter:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == 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 possibl...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== 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 [[WordPress:Function Reference/remove action|remove_action()]], [[WordPress:Function Reference/add filter|add_filter()]] and [[WordPress:Function Reference/add action|add_action()]].
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 [[WordPress:Function Reference/remove action|remove_action()]], [[WordPress:Function Reference/add filter|add_filter()]] and [[WordPress:Function Reference/add action|add_action()]].
这个函数移除了附加在某个filter hook上的函数。这种方法可以用来移除附加在某个filter hook上的默认函数,同时可以将这些默认函数替换为另一个函数。也看看[[WordPress:Function Reference/remove action|remove_action()]], [[WordPress:Function Reference/add filter|add_filter()]] 和 [[WordPress:Function Reference/add action|add_action()]]。


'''''Important:''' To remove a hook, the <tt>$function_to_remove</tt> and <tt>$priority</tt> arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.''
'''''Important:''' To remove a hook, the <tt>$function_to_remove</tt> and <tt>$priority</tt> 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时,<tt>$function_to_remove</tt>和<tt>$priority</tt>参数必须匹配。这也同样适用于filters和actions。移除操作失败,不会给通知。


== Example ==
== Example ==
== 例子 ==


This function is identical to the [[WordPress:Function Reference/remove action|remove_action()]] function.
This function is identical to the [[WordPress:Function Reference/remove action|remove_action()]] function.
  <?php remove_filter($tag, $function_to_remove, $priority, $accepted_args); ?>
  <?php remove_filter($tag, $function_to_remove, $priority, $accepted_args); ?>
这个函数与[[WordPress:Function Reference/remove action|remove_action()]]函数是相同的。
<?php remove_filter($tag, $function_to_remove, $priority, $accepted_args); ?>


== Parameters ==
== Parameters ==
== 参数 ==




{{Parameter|$tag|string|The action hook to which the function to be removed is hooked.}}
{{Parameter|$tag|string|The action hook to which the function to be removed is hooked.}}
{{Parameter|$tag|string|函数将要被移除的action hook is hooked。}}
{{Parameter|$function_to_remove|string|The name of the function which should be removed.}}
{{Parameter|$function_to_remove|string|The name of the function which should be removed.}}
{{Parameter|$function_to_remove|string|将要被移除的函数名。}}
{{Parameter|$priority|int|The priority of the function (as defined when the function was originally hooked).|optional|10}}
{{Parameter|$priority|int|The priority of the function (as defined when the function was originally hooked).|optional|10}}
{{Parameter|$priority|int|函数的优先级 (函数最初的hooked时候,已经定义了)。|optional|10}}
{{Parameter|$accepted_args|int|The number of arguments the function accepts.|optional|1}}
{{Parameter|$accepted_args|int|The number of arguments the function accepts.|optional|1}}
{{Parameter|$accepted_args|int|函数接受的参数的数目。|optional|1}}


== Return ==
== Return ==
== 返回 ==


(''boolean'') Whether the function is removed.
(''boolean'') Whether the function is removed.
(''boolean'') 函数是否被移除。


; <tt>True</tt> : The function was successfully removed.
; <tt>True</tt> : The function was successfully removed.
; <tt>False</tt> : The function could not be removed.
; <tt>False</tt> : The function could not be removed.
; <tt>True</tt> : 函数被成功地移除了。
; <tt>False</tt> : 函数没有被移除。

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
函数没有被移除。