函数原型
doing_filter( string|null $hook_name = null ): bool
函数描述
Returns whether or not a filter hook is currently being processed.
是否弃用
未弃用
函数参数
-
$hook_name
string|null
Optional - Filter hook to check. Defaults to null, which checks if any filter is currently being run.
Default:
null
函数返回值
bool Whether the filter is currently in the stack.
函数位置
File: wp-includes/plugin.php.
函数源码
function doing_filter( $hook_name = null ) {
global $wp_current_filter;
if ( null === $hook_name ) {
return ! empty( $wp_current_filter );
}
return in_array( $hook_name, $wp_current_filter, true );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |

