doing_action()
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.
Uses: doing_filter()
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
#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
- See: current_action()
- See: did_action()
Changelog
| Since 3.9.0 | Introduced. |
doing_action() doing action code WP 6.9.1
function doing_action( $hook_name = null ) {
return doing_filter( $hook_name );
}