did_filter()
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() did filter WP 6.5.2
function did_filter( $hook_name ) { global $wp_filters; if ( ! isset( $wp_filters[ $hook_name ] ) ) { return 0; } return $wp_filters[ $hook_name ]; }