Skip to content

Instantly share code, notes, and snippets.

@agiannis
Last active July 26, 2019 01:33
Show Gist options
  • Save agiannis/5ea0ffeb5f83228c7206 to your computer and use it in GitHub Desktop.
Save agiannis/5ea0ffeb5f83228c7206 to your computer and use it in GitHub Desktop.
label: wordpress
/**
* 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