WordPress at a glance

doing_filter() WP 1.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 (despite not being the most recent filter to fire, in the case of hooks called from hook callbacks) to be verified.

Basis of: 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( $filter );
Filter to check.
Default: null, which checks if any filter is currently being run


  • See: current_filter()
  • See: did_action()
  • Global. String[]. $wp_current_filter Current filter.


Since 3.9.0 Introduced.

Code of doing_filter() WP 5.7.1

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

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

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

From tag: Filters (hooks)

More from category: Hooks (actions, filters)

No comments
    Log In