remove_all_actions()WP 2.7.0

Removes all of the callback functions from an action hook.

No Hooks.


true. Always returns true.


remove_all_actions( $hook_name, $priority );
$hook_name(string) (required)
The action to remove callbacks from.
The priority number to remove them from.
Default: false



#1 Remove all functions (hooks) attached to the event

remove_all_actions( 'login_head' );

#2 Remove only hooks with priority 9 from the login_head event

remove_all_actions( 'login_head', 9 );

This will cause that, most of the post text events will be disabled - i.e. all events with priority 9 will be disabled. These are:

// from the file: /wp-includes/default-filters.php
add_action( 'login_head', 'wp_print_head_scripts', 9 ); // Will be removed
add_action( 'login_head', 'print_admin_styles', 9 ); // Will be removed
add_action( 'login_head', 'wp_robots', 1 ); // Remaining
add_action( 'login_head', 'wp_resource_hints', 8 ); // Remaining
add_action( 'login_head', 'wp_site_icon', 99 ); // Will remain

#3 Cancel callbacks in the Kadence theme on the woocommerce_before_shop_loop event

In Kadence theme on the event woocommerce_before_shop_loop a method is triggered, which I would like to disable, but how to do it, because the class object cannot be obtained in this case. One of the easiest ways is to use the remove_all_actions() function.

Briefly, how the hook is added:

namespace Kadence\Woocommerce;

class Component implements Component_Interface {

	public function initialize() {
		add_action( 'woocommerce_before_shop_loop', array( $this, 'archive_loop_top' ), 20 );


// In another file is used without access to this object

Since we don't have an object of this class on hand and the method is not static, the way to cancel this event is as follows:

add_action( 'wp_head', function () {
	remove_all_actions( 'woocommerce_before_shop_loop', 20 );
} );

We delete the event on the wp_head hook, since it is 100% registered and has functions attached to it. We also specify the same priority as it was when we registered it, so that we don't delete other colbacks, if there were any. Important, the function will remove (unbind) all functions attached to the event woocommerce_before_shop_loop with a priority of 20, which may not be a suitable solution in your task (there are many colbacks registered with this priority, and you need to remove only one, then you will need the script wp-filters-extras). In the current task, there was only one such function and it was suitable for the solution.


Since 2.7.0 Introduced.

remove_all_actions() code WP 6.4.3

function remove_all_actions( $hook_name, $priority = false ) {
	return remove_all_filters( $hook_name, $priority );