did_filter()
Retrieves the number of times a filter has been applied during the current request.
No Hooks.
Returns
Int. The number of times the filter hook has been applied.
Usage
did_filter( $hook_name );
- $hook_name(string) (required)
- The name of the filter hook.
Notes
- Global. Int[].
$wp_filtersStores the number of times each filter was triggered.
Changelog
| Since 6.1.0 | Introduced. |
did_filter() did filter code WP 7.0
function did_filter( $hook_name ) {
global $wp_filters;
if ( ! isset( $wp_filters[ $hook_name ] ) ) {
return 0;
}
return $wp_filters[ $hook_name ];
}