Codex tools: Log in
Contents |
Takes a URL and Attempts to fetch the embed HTML for it using oEmbed.
<?php $embed_code = wp_oembed_get( $url, $args = ); ?>
Retrieve the embed code for a URL from a supported oEmbed provider:
<?php $embed_code = wp_oembed_get('http://www.youtube.com/watch?v=AbcDeFg123'); ?>
Retrieve the embed code for a URL from a supported oEmbed provider - with width argument:
<?php $embed_code = wp_oembed_get('http://www.youtube.com/watch?v=AbcDeFg123', array('width'=>400)); ?>
wp_oembed_get() is located in wp-includes/media.php.
Since: 2.9.0