remove_all_{actions|filters}. Fixes #7216 props filosofo and santosj.
git-svn-id: https://develop.svn.wordpress.org/trunk@8660 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
70dc6f6b85
commit
120a3d3cf1
@ -206,6 +206,30 @@ function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all of the hooks from a filter.
|
||||||
|
*
|
||||||
|
* @since 2.7
|
||||||
|
*
|
||||||
|
* @param string $tag The filter to remove hooks from.
|
||||||
|
* @param int $priority The priority number to remove.
|
||||||
|
* @return bool True when finished.
|
||||||
|
*/
|
||||||
|
function remove_all_filters($tag, $priority = false) {
|
||||||
|
global $wp_filter, $merge_filters;
|
||||||
|
|
||||||
|
if( isset($wp_filter[$tag]) ) {
|
||||||
|
if( false !== $priority && isset($$wp_filter[$tag][$priority]) )
|
||||||
|
unset($wp_filter[$tag][$priority]);
|
||||||
|
else
|
||||||
|
unset($wp_filter[$tag]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( isset($merged_filters[$tag]) )
|
||||||
|
unset($merged_filters[$tag]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name of the current filter or action.
|
* Return the name of the current filter or action.
|
||||||
@ -427,6 +451,19 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
|
|||||||
return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
|
return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all of the hooks from an action.
|
||||||
|
*
|
||||||
|
* @since 2.7
|
||||||
|
*
|
||||||
|
* @param string $tag The action to remove hooks from.
|
||||||
|
* @param int $priority The priority number to remove them from.
|
||||||
|
* @return bool True when finished.
|
||||||
|
*/
|
||||||
|
function remove_all_actions($tag, $priority = false) {
|
||||||
|
return remove_all_filters($tag, $priority);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Functions for handling plugins.
|
// Functions for handling plugins.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user