wp_doing_ajax
云策文档标注
概述
wp_doing_ajax 是一个 WordPress 过滤器,用于判断当前请求是否为 Ajax 请求。它基于 DOING_AJAX 常量进行过滤,允许开发者修改判断逻辑。
关键要点
- 过滤器名称:wp_doing_ajax
- 参数:$wp_doing_ajax(布尔值),表示当前请求是否为 WordPress Ajax 请求
- 默认返回:defined( 'DOING_AJAX' ) && DOING_AJAX 的结果
- 相关函数:wp_doing_ajax(),位于 wp-includes/load.php
- 引入版本:4.7.0
原文内容
Filters whether the current request is a WordPress Ajax request.
Parameters
$wp_doing_ajaxbool-
Whether the current request is a WordPress Ajax request.
Source
return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |