wp_oembed_get() WordPress Function

The wp_oembed_get() function is used to get the HTML markup for an oEmbed resource. This function is used by the oEmbed feature to fetch the embed code for a given URL.

wp_oembed_get( string $url, array|string $args = '' ) #

Attempts to fetch the embed HTML for a provided URL using oEmbed.


Description

Top ↑

See also


Top ↑

Parameters

$url

(string)(Required)The URL that should be embedded.

$args

(array|string)(Optional)Additional arguments for retrieving embed HTML.

  • 'width'
    (int|string) Optional. The maxwidth value passed to the provider URL.
  • 'height'
    (int|string) Optional. The maxheight value passed to the provider URL.
  • 'discover'
    (bool) Optional. Determines whether to attempt to discover link tags at the given URL for an oEmbed provider when the provider URL is not found in the built-in providers list. Default true.

Default value: ''


Top ↑

Return

(string|false) The embed HTML on success, false on failure.


Top ↑

Source

File: wp-includes/embed.php

function wp_oembed_get( $url, $args = '' ) {
	$oembed = _wp_oembed_get_object();
	return $oembed->get_html( $url, $args );
}


Top ↑

Changelog

Changelog
VersionDescription
2.9.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.