wp_oembed_add_discovery_links

The timeline below displays how wordpress function wp_oembed_add_discovery_links has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Adds oEmbed discovery links in the head element of the website.
 *
 * @since 4.4.0
 */
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);
}

WordPress Version: 4.6

/**
 * Adds oEmbed discovery links in the website <head>.
 *
 * @since 4.4.0
 */
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);
}

WordPress Version: 4.5

/**
 * Adds oEmbed discovery links in the website <head>.
 *
 * @since 4.4.0
 */
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";
        }
    }
    /**
     * Filter the oEmbed discovery links HTML.
     *
     * @since 4.4.0
     *
     * @param string $output HTML of the discovery links.
     */
    echo apply_filters('oembed_discovery_links', $output);
}

WordPress Version: 4.1

/**
 * Adds oEmbed discovery links in the website <head>.
 *
 * @since 4.4.0
 */
function wp_oembed_add_discovery_links()
{
    $output = '';
    if (is_singular() && !is_front_page()) {
        $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";
        }
    }
    /**
     * Filter the oEmbed discovery links HTML.
     *
     * @since 4.4.0
     *
     * @param string $output HTML of the discovery links.
     */
    echo apply_filters('oembed_discovery_links', $output);
}

WordPress Version: 4.4

/**
 * Adds oEmbed discovery links in the website <head>.
 *
 * @since 4.4.0
 */
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";
        }
    }
    /**
     * Filter the oEmbed discovery links HTML.
     *
     * @since 4.4.0
     *
     * @param string $output HTML of the discovery links.
     */
    echo apply_filters('oembed_discovery_links', $output);
}