remove_class_action

Remove Class Action Without Access to Class Object.

Description

remove_class_action( (string) $tag, (string) $class_name = '', (string) $method_name = '', (int) $priority = 10 ); 

In order to use the core WordPress remove_action() on an action added with the callback to a class, you either have to have access to that class object, or it has to be a call to a static method. This method allows you to remove actions with a callback to a class you don't have access to.

Works with WordPress 1.2 - 4.7+

Parameters (4)

0. $tag (string)
Action to remove
1. $class_name — Optional. (string) => ''
Class name for the action's callback
2. $method_name — Optional. (string) => ''
Method name for the action's callback
3. $priority — Optional. (int) => 10
Priority of the action (default 10)

Usage

  1. if ( !function_exists( 'remove_class_action' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/helpers.php'; 
  3.  
  4. // Action to remove 
  5. $tag = ''; 
  6.  
  7. // Class name for the action's callback 
  8. $class_name = ''; 
  9.  
  10. // Method name for the action's callback 
  11. $method_name = ''; 
  12.  
  13. // Priority of the action (default 10) 
  14. $priority = 10; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = remove_class_action($tag, $class_name, $method_name, $priority); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/helpers.php  
  1. function remove_class_action( $tag, $class_name = '', $method_name = '', $priority = 10 ) { 
  2. remove_class_filter( $tag, $class_name, $method_name, $priority );