doing_filter()WP 3.9.0

Retrieve the name of a filter currently being processed.

The function current_filter() only returns the most recent filter or action being executed. did_action() returns true once the action is initially processed.

This function allows detection for any filter currently being executed (regardless of whether it's the most recent filter to fire, in the case of hooks called from hook callbacks) to be verified.

Used By: doing_action()
1 time — 0.000012 sec (very fast) | 50000 times — 0.01 sec (speed of light) | PHP 7.0.8, WP 4.5.3

No Hooks.


true|false. Whether the filter is currently in the stack.


doing_filter( $hook_name );
Filter hook to check.
Default: null, which checks if any filter is currently being run



Since 3.9.0 Introduced.

Code of doing_filter() WP 6.0

function doing_filter( $hook_name = null ) {
	global $wp_current_filter;

	if ( null === $hook_name ) {
		return ! empty( $wp_current_filter );

	return in_array( $hook_name, $wp_current_filter, true );