On this page
wp_oembed_get( string $url, array|string $args = '' ): string|false
Attempts to fetch the embed HTML for a provided URL using oEmbed.
Description
See also
Parameters
$urlstring Required-
The URL that should be embedded.
$argsarray|string Optional-
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
string|false The embed HTML on success, false on failure.
Source
File: wp-includes/embed.php. View all references
function wp_oembed_get( $url, $args = '' ) {
$oembed = _wp_oembed_get_object();
return $oembed->get_html( $url, $args );
}
Related
Uses
| Uses | Description |
|---|---|
| _wp_oembed_get_object() wp-includes/embed.php | Returns the initialized WP_oEmbed object. |
Used By
| Used By | Description |
|---|---|
| WP_Widget_Media_Video::render_media() wp-includes/widgets/class-wp-widget-media-video.php | Render the media on the frontend. |
| WP_Embed::shortcode() wp-includes/class-wp-embed.php | The do_shortcode() callback function. |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_oembed_get