WP_Hook::remove_all_filters() WordPress Method

The WP_Hook::remove_all_filters() method is used to remove all filters from a hook. This is useful for clean-up purposes when you want to remove all filters from a hook, or when you want to make sure that no more filters are added to a hook.

WP_Hook::remove_all_filters( int|false $priority = false ) #

Removes all callbacks from the current filter.


Parameters

$priority

(int|false)(Optional) The priority number to remove.

Default value: false


Top ↑

Source

File: wp-includes/class-wp-hook.php

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

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

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


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.