A WordPress-centric search engine for devs and theme authors



wp_oembed_ensure_format ›

Since4.4.0
Deprecatedn/a
wp_oembed_ensure_format ( $format )
Parameters:
  • (string) $format The oEmbed response format. Accepts 'json' or 'xml'.
    Required: Yes
Returns:
  • (string) The format, either 'xml' or 'json'. Default 'json'.
Defined at:
Codex:

Ensures that the specified format is either 'json' or 'xml'.



Source

function wp_oembed_ensure_format( $format ) {
	if ( ! in_array( $format, array( 'json', 'xml' ), true ) ) {
		return 'json';
	}

	return $format;
}