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

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibl...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述==


This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibly replace them with a substitute. See also [[WordPress:Function Reference/remove filter|remove_filter()]], [[WordPress:Function Reference/add action|add_action()]] and [[WordPress:Function Reference/add filter|add_filter()]].
This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibly replace them with a substitute. See also [[WordPress:Function Reference/remove filter|remove_filter()]], [[WordPress:Function Reference/add action|add_action()]] and [[WordPress:Function Reference/add filter|add_filter()]].
这个函数移除了附加到某个action hook上的函数。这种方法也可以用来移除复交到某个action hook上的默认函数而且将替换为其它的函数。也看看[[WordPress:Function Reference/remove filter|remove_filter()]], [[WordPress:Function Reference/add action|add_action()]] 和 [[WordPress:Function Reference/add filter|add_filter()]]。


'''''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,<tt>$function_to_remove</tt> 和<tt>$priority</tt>参数在添加hook的时候,必须匹配。这一点同样适用于filters和actions。移除失败,不会给通知。''


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


This function is identical to the [[WordPress:Function Reference/remove filter|remove_filter()]] function.
This function is identical to the [[WordPress:Function Reference/remove filter|remove_filter()]] function.
这个函数与[[WordPress:Function Reference/remove filter|remove_filter()]]函数相同。
  <?php remove_action($tag, $function_to_remove, $priority, $accepted_args); ?>
  <?php remove_action($tag, $function_to_remove, $priority, $accepted_args); ?>
<?php remove_action($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|The action hook to which the function to be removed 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'') 函数是否被移除。


; <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日 (一) 16:22的版本

Description

描述

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

这个函数移除了附加到某个action hook上的函数。这种方法也可以用来移除复交到某个action hook上的默认函数而且将替换为其它的函数。也看看remove_filter(), add_action()add_filter()

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,$function_to_remove$priority参数在添加hook的时候,必须匹配。这一点同样适用于filters和actions。移除失败,不会给通知。

Example

例子

This function is identical to the remove_filter() function.

这个函数与remove_filter()函数相同。

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

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

Parameters

参数

Return

返回

(boolean) 函数是否被移除。

True
The function was successfully removed.
False
The function could not be removed.
True
函数成功地移除了。
False
函数不能够移除。