wp_oembed_ensure_format() WordPress Function

The wp_oembed_ensure_format() function is used to make sure that the oEmbed response is in the specified format. It is used to ensure that the oEmbed response is in the specified format.

wp_oembed_ensure_format( string $format ) #

Ensures that the specified format is either ‘json’ or ‘xml’.


Parameters

$format

(string)(Required)The oEmbed response format. Accepts 'json' or 'xml'.


Top ↑

Return

(string) The format, either 'xml' or 'json'. Default 'json'.


Top ↑

Source

File: wp-includes/embed.php

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

	return $format;
}

Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.