WP_oEmbed::get_data()publicWP 4.8.0

Takes a URL and attempts to return the oEmbed data.

Method of the class: WP_oEmbed{}

No Hooks.

Return

Object|false. The result in the form of an object on success, false on failure.

Usage

$WP_oEmbed = new WP_oEmbed();
$WP_oEmbed->get_data( $url, $args );
$url(string) (required)
The URL to the content that should be attempted to be embedded.
$args(string|array)
Additional arguments for retrieving embed HTML. See wp_oembed_get() for accepted arguments.
Default: ''

Notes

Changelog

Since 4.8.0 Introduced.

WP_oEmbed::get_data() code WP 6.5.2

public function get_data( $url, $args = '' ) {
	$args = wp_parse_args( $args );

	$provider = $this->get_provider( $url, $args );

	if ( ! $provider ) {
		return false;
	}

	$data = $this->fetch( $provider, $url, $args );

	if ( false === $data ) {
		return false;
	}

	return $data;
}