remove_all_filters() WordPress Function
The remove_all_filters() function is a powerful tool for developers who need to remove all filters from a specified hook. This function can be used to remove filters that are added by plugins or themes, or even to remove filters that are added by the WordPress core.
remove_all_filters( string $hook_name, int|false $priority = false ) #
Removes all of the callback functions from a filter hook.
Parameters
- $hook_name
(string)(Required)The filter to remove callbacks from.
- $priority
(int|false)(Optional) The priority number to remove them from.
Default value: false
Return
(true) Always returns true.
Source
File: wp-includes/plugin.php
function remove_all_filters( $hook_name, $priority = false ) {
global $wp_filter;
if ( isset( $wp_filter[ $hook_name ] ) ) {
$wp_filter[ $hook_name ]->remove_all_filters( $priority );
if ( ! $wp_filter[ $hook_name ]->has_filters() ) {
unset( $wp_filter[ $hook_name ] );
}
}
return true;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |