On this page
WP_oEmbed::get_data( string $url, string|array $args = '' ): object|false
Takes a URL and attempts to return the oEmbed data.
Description
See also
Parameters
$urlstring Required-
The URL to the content that should be attempted to be embedded.
$argsstring|array Optional-
Additional arguments for retrieving embed HTML.
See wp_oembed_get() for accepted arguments.More Arguments from wp_oembed_get( ... $args )
Additional arguments for retrieving embed HTML.
widthint|stringOptional. Themaxwidthvalue passed to the provider URL.heightint|stringOptional. Themaxheightvalue passed to the provider URL.discoverboolOptional. 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:
''
Return
object|false The result in the form of an object on success, false on failure.
Source
File: wp-includes/class-wp-oembed.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| WP_oEmbed::get_provider() wp-includes/class-wp-oembed.php | Takes a URL and returns the corresponding oEmbed provider’s URL, if there is one. |
| WP_oEmbed::fetch() wp-includes/class-wp-oembed.php | Connects to a oEmbed provider and returns the result. |
| wp_parse_args() wp-includes/functions.php | Merges user defined arguments into defaults array. |
Used By
| Used By | Description |
|---|---|
| WP_oEmbed::get_html() wp-includes/class-wp-oembed.php | The do-it-all function that takes a URL and attempts to return the HTML. |
Changelog
| Version | Description |
|---|---|
| 4.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_oembed/get_data