remove_all_filters( string $hook_name, int|false $priority = false ): true
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:
false
Return
true Always returns true.
Source
File: wp-includes/plugin.php
.
View all references
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;
}
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example:
This example will remove all hooks from the_content function, for any plugin or theme.
But if you only want to remove a particular set of hooks at a particular priority, you can use a priority, 10 being the default used for most filters:
Since class-derived filters can be tricky to remove, if they use a non-default priority (take 15 for example), you could do this instead:
Example:
This example will remove all of the plugins hooks from the_content function.
Top ↑
Feedback
What is `plugin_filters` here if the second parameter is a `$priority` number? — By HelgaTheViking —