WP_oEmbed::get_data() WordPress Method

The WP_oEmbed::get_data() method is used to get the oEmbed data for a given URL. This data can then be used to embed the content from that URL into a WordPress post or page.

WP_oEmbed::get_data( string $url, string|array $args = '' ) #

Takes a URL and attempts to return the oEmbed data.


Description

Top ↑

See also


Top ↑

Parameters

$url

(string)(Required)The URL to the content that should be attempted to be embedded.

$args

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

Default value: ''


Top ↑

Return

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


Top ↑

Source

File: wp-includes/class-wp-oembed.php

	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;
	}


Top ↑

Changelog

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