remove_action( string $tag, callable $function_to_remove, int $priority = 10 )
Removes a function from a specified action hook.
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 filter hook and possibly replace them with a substitute.
Parameters Parameters
- $tag
-
(string) (Required) The action hook to which the function to be removed is hooked.
- $function_to_remove
-
(callable) (Required) The name of the function which should be removed.
- $priority
-
(int) (Optional) The priority of the function.
Default value: 10
Return Return
(bool) Whether the function is removed.
Source Source
File: wp-includes/plugin.php
function remove_action( $tag, $function_to_remove, $priority = 10 ) { return remove_filter( $tag, $function_to_remove, $priority ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
1.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
This function is identical to the remove_filter() function.
If an action has been added from within a class, for example by a plugin, removing it will require accessing the class variable.
It is also worth noting that you may need to prioritise the removal of the action to a hook that occurs after the action is added. You cannot successfully remove the action before it has been added.
If you need to be able to remove an action/filter for a class object you do not have access to, you can do so with this function (which includes support for WordPress 4.7+):
Expand full source codeCollapse full source code
https://gist.github.com/tripflex/c6518efc1753cf2392559866b4bd1a53
Related:
do_action()
add_action()
Expand full source codeCollapse full source code