WordPress at Your Fingertips

remove_all_filters() WP 1.0

Remove all of the hooks from a filter.

No Hooks.

Return

true. Always returns true.

Usage

remove_all_filters( $hook_name, $priority );
$hook_name(string) (required)
The filter to remove callbacks from.
$priority(int|false)
The priority number to remove them from.
Default: false

Notes

  • Global. WP_Hook[]. $wp_filter Stores all of the filters and actions.

Changelog

Since 2.7.0 Introduced.

Code of remove_all_filters() WP 5.8

<?php
function remove_all_filters( $hook_name, $priority = false ) {
	global $wp_filter;

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

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

	return true;
}

From tag: Filters (hooks)

More from category: Hooks (actions, filters)

No comments
    Log In