The What
Syntax
bool remove_action ( string $event_name, callable $callback_name, integer $priority = 10 );
Description
This construct removes the specified registered callback from the event registry lookup table, i.e. $wp_filter
.
Parameters
event_name
- The name of the event that the callback is registered to.
callback_name
- The fully qualified name of your callback.
priority
- optional Specifies the calling order with the lowest number being called first. It defaults to 10.
Return Values
Returns true
if the callback is registered.
Show It in ActionBasic
Let’s see the remove_action
function in action. In this video, you will see how it works.
Go DeepPro
In this video, you will go deeper into the instruction by looking at WordPress Core.
Generate a Unique IDPro
When registering an object’s method, static method, or closure, the event registry look-up table needs to generate a unique ID for the key in the registry (remember it’s an array). Let’s reverse engineer the function _wp_filter_build_unique_id()
to better understand the event registry system in WordPress as well as how to grab ahold of a callback to unregister it.
Your best friend is code, Tonya is making the introductions.
Unregistering an Object’s MethodPro
These two videos you will first learn about why you must grab the actual object (slight introduction to OOP) and then how to actually unregister the object’s method callback.
Unregistering a Static MethodPro
In this video, you will walk through and reverse engineer WordPress Core to understand how to unregister a static method.
Unregistering a ClosurePro
In this video, you will walk through and reverse engineer WordPress Core to understand how to unregister a closure, or if you can unregister one.
PHP Constructs
These are the PHP constructs used in WordPress Core for remove_action
: