wp_is_json_media_type() – Checks whether a string is a valid JSON Media Type.

You appear to be a bot. Output may be restricted

Description

Checks whether a string is a valid JSON Media Type.

Usage

$bool = wp_is_json_media_type( $media_type );

Parameters

$media_type
( string ) required – A Media Type string to check.

Returns

bool True if string is a valid JSON Media Type.

Source

File name: wordpress/wp-includes/load.php
Lines:

1 to 9 of 9
function wp_is_json_media_type( $media_type ) {
  static $cache = array();

  if ( ! isset( $cache[ $media_type ] ) ) {
    $cache[ $media_type ] = (bool) preg_match( '/(^|\s|,)application\/([\w!#\$&-\^\.\+]+\+)?json(\+oembed)?($|\s|;|,)/i', $media_type );
  }

  return $cache[ $media_type ];
}
 

 View on GitHub View on Trac