Takes a URL and attempts to return the oEmbed data.
Description
See also
Parameters
$url
stringrequired- The URL to the content that should be attempted to be embedded.
$args
string|arrayoptional- 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.
width
int|stringOptional. Themaxwidth
value passed to the provider URL.height
int|stringOptional. Themaxheight
value passed to the provider URL.discover
boolOptional. 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:
''
Source
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;
}
Changelog
Version | Description |
---|---|
4.8.0 | Introduced. |
This function is notoriously used by the Youtube Gutenberg block to retrieve video markup (among other)
It’s subject to any Google/Vimeo/… oEmbed provider blacklisting strategy. As an example, we found that Youtube would ban any WordPress instance hosted on OVH/US-cloud IP range from retrieving the markup (= strongly limiting oEmbed, thus WP hosting on a (competing) hosting provider)