wp_oembed_ensure_format

The timeline below displays how wordpress function wp_oembed_ensure_format has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.4

/**
 * Ensures that the specified format is either 'json' or 'xml'.
 *
 * @since 4.4.0
 *
 * @param string $format The oEmbed response format. Accepts 'json' or 'xml'.
 * @return string The format, either 'xml' or 'json'. Default 'json'.
 */
function wp_oembed_ensure_format($format)
{
    if (!in_array($format, array('json', 'xml'), true)) {
        return 'json';
    }
    return $format;
}