wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_oembed_ensure_format › WordPress Function

Since4.4.0
已弃用n/a
wp_oembed_ensure_format ( $format )
参数:
  • (string) $format The oEmbed response format. Accepts 'json' or 'xml'.
    Required: Yes
返回:
  • (string) The format, either 'xml' or 'json'. Default 'json'.
定义在:
文档:

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



源码

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

	return $format;
}