Using WordPress ‘remove_all_actions()’ PHP function

The remove_all_actions() WordPress PHP function removes all of the callback functions from an action hook.

Usage

remove_all_actions($hook_name, $priority = false);
  • Custom example:
remove_all_actions('init');

This will remove all callback functions attached to the ‘init’ action hook.

Parameters

  • $hook_name (string) – The action hook to remove callbacks from.
  • $priority (int|false, optional) – The priority number to remove the callbacks from. Default is false, which removes from all priorities.

More information

See WordPress Developer Resources: remove_all_actions()

Examples

Remove all callbacks from ‘admin_init’ action hook

This example removes all callbacks from the ‘admin_init’ action hook.

remove_all_actions('admin_init');

Remove all callbacks with priority 10 from ‘wp_enqueue_scripts’ action hook

This example removes all callbacks with priority 10 from the ‘wp_enqueue_scripts’ action hook.

remove_all_actions('wp_enqueue_scripts', 10);

Remove all callbacks from ‘save_post’ action hook

This example removes all callbacks from the ‘save_post’ action hook.

remove_all_actions('save_post');

Remove all callbacks with priority 5 from ‘widgets_init’ action hook

This example removes all callbacks with priority 5 from the ‘widgets_init’ action hook.

remove_all_actions('widgets_init', 5);

This example removes all callbacks from the ‘wp_footer’ action hook.

remove_all_actions('wp_footer');