Add external media to the media library
Add external media from a supported oEmbed provider (YouTube, Vimeo, SoundCloud, Twitter, …) to the media library
No, external media attachments just contain URL references to the original resources
$oembed = new WP_oEmbed();
$oembed_width = get_post_meta( $attachment->ID, ‘_oembed_width’, true );
$oembed_height = get_post_meta( $attachment->ID, ‘_oembed_height’, true );
echo $oembed->get_html( wp_get_attachment_url( $attachment->ID ), array( ‘width’ => $oembed_width, ‘height’ => $oembed_height ) );
Some service providers, such as Twitter and Instagram, have a maximum and minimum allowed width and ignore the height setting completely