Uses
Uses | Description |
---|---|
wp-includes/embed.php: _oembed_create_xml() | Creates an XML string from a given array. |
wp-includes/formatting.php: esc_html() | Escaping for HTML blocks. |
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Creates an XML string from a given array.
(array) (Required) The original oEmbed response data.
(SimpleXMLElement) (Optional) XML node to append the result to recursively.
Default value: null
(string|false) XML string on success, false on error.
File: wp-includes/embed.php
function _oembed_create_xml( $data, $node = null ) { if ( ! is_array( $data ) || empty( $data ) ) { return false; } if ( null === $node ) { $node = new SimpleXMLElement( '<oembed></oembed>' ); } foreach ( $data as $key => $value ) { if ( is_numeric( $key ) ) { $key = 'oembed'; } if ( is_array( $value ) ) { $item = $node->addChild( $key ); _oembed_create_xml( $value, $item ); } else { $node->addChild( $key, esc_html( $value ) ); } } return $node->asXML(); }
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_oembed_create_xml