WP_REST_Request::is_json_content_type() – Checks if the request has specified a JSON content-type.

You appear to be a bot. Output may be restricted

Description

Checks if the request has specified a JSON content-type.

Usage

$bool = WP_REST_Request::is_json_content_type();

Parameters

Returns

bool True if the content-type header is JSON.

Source

File name: wordpress/wp-includes/rest-api/class-wp-rest-request.php
Lines:

1 to 5 of 5
  public function is_json_content_type() {
    $content_type = $this->WP_REST_Request::get_content_type();

    return isset( $content_type['value'] ) && wp_is_json_media_type( $content_type['value'] );
  }
 

 View on GitHub View on Trac