did_filter()WP 6.1.0

Retrieves the number of times a filter has been applied during the current request.

Хуков нет.


int. The number of times the filter hook has been applied.


did_filter( $hook_name );
$hook_name(строка) (обязательный)
The name of the filter hook.


  • Global. int[]. $wp_filters Stores the number of times each filter was triggered.

Список изменений

С версии 6.1.0 Введена.

Код did_filter() WP 6.5.3

function did_filter( $hook_name ) {
	global $wp_filters;

	if ( ! isset( $wp_filters[ $hook_name ] ) ) {
		return 0;

	return $wp_filters[ $hook_name ];