On this page
wp_is_json_request(): bool
Checks whether current request is a JSON request, or is expecting a JSON response.
Return
bool True if Accepts or Content-Type headers contain application/json.
False otherwise.
Source
File: wp-includes/load.php. View all references
function wp_is_json_request() {
if ( isset( $_SERVER['HTTP_ACCEPT'] ) && wp_is_json_media_type( $_SERVER['HTTP_ACCEPT'] ) ) {
return true;
}
if ( isset( $_SERVER['CONTENT_TYPE'] ) && wp_is_json_media_type( $_SERVER['CONTENT_TYPE'] ) ) {
return true;
}
return false;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_is_json_media_type() wp-includes/load.php | Checks whether a string is a valid JSON Media Type. |
Used By
| Used By | Description |
|---|---|
| determine_locale() wp-includes/l10n.php | Determines the current locale desired for the request. |
| plugins_api() wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| wp_debug_mode() wp-includes/load.php | Set PHP error reporting based on WordPress debug settings. |
| wp_die() wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| is_admin_bar_showing() wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_is_json_request