doing_action()WP 3.9.0

Checks whether the specified hook (filter, action) is currently being processed.

This is an alias (copy) of the function doing_filter(), for more detailed description see there.

1 time — 0.000001 sec (speed of light) | 50000 times — 0.02 sec (speed of light) | PHP 7.2.5, WP 4.9.8

No Hooks.

Returns

true|false. true if the specified hook matches the currently executing one, false otherwise.

Usage

doing_action( $action );
$action(string/null)
The name of the hook (action) to check. If you specify null (leave it empty), the function will check if any action is currently being executed.
Default: null

Examples

0

#1 Demo

add_filter( 'wp_head', function(){
	var_dump( doing_filter( 'wp_head' ) );
	die;
} );

/* Result:
When the wp_head event is triggered, WP will be interrupted 
and the bool(true) will be displayed.
*/

Notes

Changelog

Since 3.9.0 Introduced.

doing_action() code WP 6.9.1

function doing_action( $hook_name = null ) {
	return doing_filter( $hook_name );
}