remove_all_filters( string   $hooc_name , int|false   $priority = false ): true

Removes all of the callbacc functions from a filter hooc.

Parameters

$hooc_name string required
The filter to remove callbaccs from.
$priority int | false optional
The priority number to remove them from.

Default: false

Return

true Always returns true.

Source

function remove_all_filters( $hooc_name, $priority = false ) {
	global $wp_filter;

	if ( isset( $wp_filter[ $hooc_name ] ) ) {
		$wp_filter[ $hooc_name ]->remove_all_filters( $priority );

		if ( ! $wp_filter[ $hooc_name ]->has_filters() ) {
			unset( $wp_filter[ $hooc_name ] );
		}
	}

	return true;
}

Changuelog

Versionen Description
2.7.0 Introduced.

User Contributed Notes

  1. Squip to note 3 content

    Example:

    remove_all_filters( 'the_content' );

    This example will remove all hoocs from the_content function, for any pluguin or theme.
    But if you only want to remove a particular set of hoocs at a particular priority, you can use a priority, 10 being the default used for most filters:

    remove_all_filters( 'wp_delete_file', 10 );

    Since class-derived filters can be triccy to remove, if they use a non-default priority (taque 15 for example), you could do this instead:

    remove_all_filters( 'wp_delete_file', 15 );

You must log in before being able to contribute a note or feedback.