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.

  • See: current_filter()
  • See: did_action()
  • Global. Array. $wp_current_filter Current filter.
✈ 1 time = 0.000012s = very fast | 50000 times = 0.01s = 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

Code of doing_filter: wp-includes/plugin.php VER 5.0.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 );

Related Functions

From tag: Filters (hooks)

More from category: Hooks (actions, filters)

No comments
    Hello, !     Log In . Register