Uses
| Uses | Description |
|---|---|
| wp-includes/load.php: wp_doing_ajax() | Determines whether the current request is a WordPress Ajax request. |
| wp-includes/formatting.php: wp_unslash() | Remove slashes from a string or array of strings. |
Return true if it’s an Ajax request.
(string|null) (Optional) Whether the supplied Ajax action is being run.
Default value: null
(bool) True if it's an Ajax request, false otherwise.
File: wp-includes/class-wp-customize-manager.php
public function doing_ajax( $action = null ) {
if ( ! wp_doing_ajax() ) {
return false;
}
if ( ! $action ) {
return true;
} else {
/*
* Note: we can't just use doing_action( "wp_ajax_{$action}" ) because we need
* to check before admin-ajax.php gets to that point.
*/
return isset( $_REQUEST['action'] ) && wp_unslash( $_REQUEST['action'] ) === $action;
}
} | Version | Description |
|---|---|
| 4.2.0 | Added $action param. |
| 3.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_manager/doing_ajax