WP_REST_Request::is_json_content_type()
Checks if the request has specified a JSON content-type.
Return
(bool) True if the content-type header is JSON.
Source
File: wp-includes/rest-api/class-wp-rest-request.php
public function is_json_content_type() { $content_type = $this->get_content_type(); return isset( $content_type['value'] ) && wp_is_json_media_type( $content_type['value'] ); }
Changelog
Version | Description |
---|---|
5.6.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_request/is_json_content_type