WP_Hook::remove_all_filters()publicWP 4.7.0

Removes all callbacks from the current filter.

Method of the class: WP_Hook{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Hook = new WP_Hook();
$WP_Hook->remove_all_filters( $priority );
$priority(int|false)
The priority number to remove.
Default: false

Changelog

Since 4.7.0 Introduced.

WP_Hook::remove_all_filters() code WP 6.5.2

public function remove_all_filters( $priority = false ) {
	if ( ! $this->callbacks ) {
		return;
	}

	if ( false === $priority ) {
		$this->callbacks  = array();
		$this->priorities = array();
	} elseif ( isset( $this->callbacks[ $priority ] ) ) {
		unset( $this->callbacks[ $priority ] );
		$this->priorities = array_keys( $this->callbacks );
	}

	if ( $this->nesting_level > 0 ) {
		$this->resort_active_iterations();
	}
}