Using WordPress ‘remove_all_filters()’ PHP function

The remove_all_filters() WordPress PHP function removes all of the callback functions from a specified filter hook.

Usage

remove_all_filters( $hook_name, $priority )

Example:

remove_all_filters( 'the_content', 10 )

This will remove all hooks from ‘the_content’ function with priority 10.

Parameters

  • $hook_name (string) – The filter hook to remove callbacks from.
  • $priority (int|false) – The priority number to remove the callbacks from. Default: false.

More information

See WordPress Developer Resources: remove_all_filters

Examples

Removing all hooks from ‘the_content’ function

This example will remove all hooks from ‘the_content’ function, for any plugin or theme.

remove_all_filters( 'the_content' );

Removing hooks with a specific priority

Remove hooks with priority 10 from ‘wp_delete_file’ filter:

remove_all_filters( 'wp_delete_file', 10 );

Removing hooks with a non-default priority

Remove hooks with priority 15 from ‘wp_delete_file’ filter:

remove_all_filters( 'wp_delete_file', 15 );

Removing all hooks from a custom filter

Remove all hooks from a custom filter named ‘my_custom_filter’:

remove_all_filters( 'my_custom_filter' );

Removing hooks with priority 5 from a custom filter

Remove hooks with priority 5 from a custom filter named ‘my_custom_filter’:

remove_all_filters( 'my_custom_filter', 5 );