wp_oembed_ensure_format
Ensures that the specified format is either 'json' or 'xml'.
Description
(string) wp_oembed_ensure_format( (string) $format );
Returns (string)
The format, either 'xml' or 'json'. Default 'json'.
Parameters (1)
- 0. $format (string)
- The oEmbed response format. Accepts json or xml..
Usage
if ( !function_exists( 'wp_oembed_ensure_format' ) ) { require_once ABSPATH . WPINC . '/embed.php'; } // The oEmbed response format. Accepts 'json' or 'xml'. $format = ''; // NOTICE! Understand what this does before running. $result = wp_oembed_ensure_format($format);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/embed.php
- function wp_oembed_ensure_format( $format ) {
- if ( ! in_array( $format, array( 'json', 'xml' ), true ) ) {
- return 'json';
- }
- return $format;
- }