wp_oembed_add_discovery_links() WordPress Function
The wp_oembed_add_discovery_links() function enables discovery of oEmbed content in a WordPress site. When called, this function will add tags to the
of the current document, pointing to the WordPress oEmbed provider. This function should be called when the element is first generated.wp_oembed_add_discovery_links() #
Adds oEmbed discovery links in the head element of the website.
Source
File: wp-includes/embed.php
function wp_oembed_add_discovery_links() { $output = ''; if ( is_singular() ) { $output .= '<link rel="alternate" type="application/json+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink() ) ) . '" />' . "\n"; if ( class_exists( 'SimpleXMLElement' ) ) { $output .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url( get_oembed_endpoint_url( get_permalink(), 'xml' ) ) . '" />' . "\n"; } } /** * Filters the oEmbed discovery links HTML. * * @since 4.4.0 * * @param string $output HTML of the discovery links. */ echo apply_filters( 'oembed_discovery_links', $output ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |