Last active
July 26, 2019 01:33
-
-
Save agiannis/5ea0ffeb5f83228c7206 to your computer and use it in GitHub Desktop.
label: wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove actions that are assigned to a unknown Class | |
* @param string $action The action name | |
* @param string $function_name The method of the Class | |
* | |
*/ | |
public function remove_action_with_class($action,$function_name) { | |
if(!empty($GLOBALS['wp_filter'][$action])) { | |
foreach ($GLOBALS['wp_filter'][$action] as $position_key=>$position ) { | |
foreach ($position as $hook_key=>$hook_data) { | |
if($hook_data['function'][1] == $function_name) { | |
unset($GLOBALS['wp_filter'][$action][$position_key][$hook_key]); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment