wp_oembed_ensure_format()
Ensures that the specified format is either 'json' or 'xml'.
No Hooks.
Returns
String. The format, either 'xml' or 'json'.
Usage
wp_oembed_ensure_format( $format );
- $format(string) (required)
- The oEmbed response format. Accepts
'json'or'xml'.
Changelog
| Since 4.4.0 | Introduced. |
wp_oembed_ensure_format() wp oembed ensure format code WP 6.9.1
function wp_oembed_ensure_format( $format ) {
if ( ! in_array( $format, array( 'json', 'xml' ), true ) ) {
return 'json';
}
return $format;
}