This page redirects to an external site: https://developer.wordpress.org/reference/functions/remove_action/
This function is an alias to remove_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 remove_filter(), add_action() and 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.
<code style="color: #000000"><span style="color: #0000BB"><?php remove_action</span><span style="color: #007700">( </span><span style="color: #0000BB">$tag</span><span style="color: #007700">, </span><span style="color: #0000BB">$function_to_remove</span><span style="color: #007700">, </span><span style="color: #0000BB">$priority </span><span style="color: #007700">); </span><span style="color: #0000BB">?></span></code>
This function is identical to the remove_filter() function.
<code style="color: #000000"> <span style="color: #0000BB"><?php remove_action</span><span style="color: #007700">( </span><span style="color: #0000BB">$tag</span><span style="color: #007700">, </span><span style="color: #0000BB">$function_to_remove</span><span style="color: #007700">, </span><span style="color: #0000BB">$priority </span><span style="color: #007700">); </span><span style="color: #0000BB">?></span> </code>
remove_action() must be called inside a function and cannot be called directly in your plugin or theme.
add_action( 'wp_head', 'remove_my_action' );
function remove_my_action(){
remove_action( 'wp_footer', 'function_being_removed' );
}
If an action has been added from within a class, for example by a plugin, removing it will require accessing the class through a variable that holds the class instance.
add_action( 'wp_head', 'remove_my_class_action' );
function remove_my_class_action(){
global $my_class;
remove_action( 'wp_footer', array( $my_class, 'class_function_being_removed' ) );
}
Unless the function is static in which case you could call the class and function directly.
add_action( 'wp_head', 'remove_my_class_action' );
function remove_my_class_action(){
remove_action( 'wp_footer', array( 'My_Class', 'class_function_being_removed' ) );
}
Notes
Since: 1.2.0
remove_action() is located in wp-includes/plugin.php.