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

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


Description

See also


Parameters

$url

(Required) The URL that should be embedded.

$args

(Optional) Additional arguments for retrieving embed HTML. <br>

  • 'width'
    (int|string) Optional. The maxwidth value passed to the provider URL.<br>
  • 'height'
    (int|string) Optional. The maxheight value passed to the provider URL.<br>
  • '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.<br>

Default value: ''


Return

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


Source

File: wp-includes/embed.php

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


Changelog

Changelog
Version Description
2.9.0 Introduced.