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
See also
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: ''
Return
(object|false) The result in the form of an object on success, false on failure.
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.8.0 | Introduced. |