WP_Hook::remove_filter( string $hook_name, callable|string|array $callback, int $priority )

Removes a callback function from a filter hook.



(string) (Required) The filter hook to which the function to be removed is hooked.


(callable|string|array) (Required) The callback to be removed from running when the filter is applied. This method can be called unconditionally to speculatively remove a callback that may or may not exist.


(int) (Required) The exact priority used when adding the original filter callback.

Top ↑


(bool) Whether the callback existed before it was removed.

Top ↑


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

	public function remove_filter( $hook_name, $callback, $priority ) {
		$function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );

		$exists = isset( $this->callbacks[ $priority ][ $function_key ] );

		if ( $exists ) {
			unset( $this->callbacks[ $priority ][ $function_key ] );

			if ( ! $this->callbacks[ $priority ] ) {
				unset( $this->callbacks[ $priority ] );

				if ( $this->nesting_level > 0 ) {

		return $exists;

Top ↑


Version Description
4.7.0 Introduced.

Top ↑

User Contributed Notes

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