Aha! WordPress has a built in function for it 😀
<?php echo $embed_code = wp_oembed_get( $video ); ?>
Simples.
Related Posts:
- Video Embed with Captions in Turkish
- How to auto embedded youtube with wp_insert_post()
- Setting a post’s featured image from an embedded YouTube video
- Do_Shortcode not working for Embed
- How do I embed youtube videos with https instead of http in the URL?
- Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer
- How to change thumbnail of embedded Youtube video?
- How to add new embed handler not supported by oembed
- Manipulating oembed_dataparse stopped working for YouTube embeds
- Youtube – Embed as IFRAME
- Is it possible to modify the default YouTube embed attributes string?
- Youtube parameters within WordPress embed code?
- vimeo/youtube video embed with thumbnails
- disable video URL auto-embedding for a part of the post
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- YouTube embed parameters?
- Embed Youtube video link in wordpress editor
- WordPress get embedded/attachment video
- MP4 video on wordpress working on desktop, not on mobile devices
- How to change the way wp_embed handles only youtube videos?
- How to embed YouTube videos in posts without adding suggested videos at the end?
- How to make my new theme read [youtube id=”id of the video here” width=”600″ height=”350″]?
- Div around YouTube video
- Embedding Youtube video on comments
- YouTube embeded video will not resize (only full screen responsive) [closed]
- TED talk embedded videos cut off by sidebar
- WordPress fails to embed video URL
- Embedded videos not displaying on page
- Youtube iframe embed keeps disappearing from page
- WordPress Mediaelement – Youtube Videos Embed Options
- how to embed a .mp4 video the url postfix with secret key
- Can someone please help me find a solution to my youtube embed problems? [duplicate]
- add_filter is failing to append &rel=0 to end of YouTube URL in oEmbed
- Youtube embedded videos unavailable
- How do I hide related videos at the end of a YouTube playlist embed code?
- Use [embed] filter in template files
- WP Oembed not passing through the “autoplay=1” variable
- How can I change Max Embed Size in WordPress 3.5?
- Get first video from the post (both embed and video shortcodes)
- Replace audio/video enclosure with player?
- Soundcloud embed shortcode does not work
- Implementing “Video of the Day” Feature?
- Modify youtube video size on one page and show another size on different page
- add_filter to youtube embeds?
- wp_embed_register_handler not working
- Embed .mov file via ‘Add Media’ not working
- How to overwrite youtube embed?
- Any way to use a custom Parameter for youtube embed without using an iframe?
- Customize Embedded Tweets (or, How To Hide Photos in Embedded Tweets)
- How to change WordPress embedded player size or show just the play button
- how to embed external webpage in my wordpress page
- wp_embed_register_handler is not working
- use of tag into wordpress
- Any way to use a custom Parameter for vimeo embed without using an iframe?
- ted talks embed fixed, but can’t control size
- Removing WordPress Icon from oembed link footer
- Add a YouTube or Vimeo video as a post attachment?
- Convert all youtube link to embed
- Get all Youtube video’s from posts and embed them on a different page
- How to embed a WordPress article on another website [closed]
- Hiding Comments Icon On oembed
- Should I use custom post types for a front page video feature (vimeo)?
- How to create a static player top or bottom of wordpress?
- Embed YouTube video on category description
- Audio Playlists – Multiple file type support?
- Vimeo video embeds doesnt seem to work with ACF [closed]
- Search XML file from within WordPress?
- WordPress keeps altering my embed code
- Can I use wp_oembed_get to detect a valid embeddable link or is there a better way to do so?
- extra text in Vimeo Embedded videos
- Check if page is embeded
- How can I override print_embed_sharing_dialog() in WordPress 4.5
- Lightbox Plus ColorBox plugin and auto playing YouTube video
- Embed Post in external page
- How can I force oEmbed to display fixed height & width dimensions?
- How to import my YouTube channel into WordPress?
- How to set YouTube video as featured image?
- Extract an embedded video from the content
- pdf (25MB) – how to display and enable download?
- Outside url for post content
- want to stop stripping out from my post content
- Is there a way to create embed codes from wordpress/buddypress content?
- oEmbed not working in WordPress
- Display total questions of Moodle in WordPress [closed]
- How to display real-time data which is stored in an IBM Cloud web app
- Embedding custom posts with REST API
- How to apply an ID to Shortcode Embedded iframe
- How can I remove the first video from a post and feature it?
- How to Implement Responsive YouTube Video Framing? [closed]
- Embedded tweets get wrapped in tags and fail to load
- How do I embed a YouTube video in WordPress 3.0?
- WordPress block editor embeds not working in theme (single.php)
- How To Display Content from a website on wordpress page?
- WordPress keeps autoplaying my Youtube-Links no matter what I write
- YouTube Sidebar Widget – YouTube service unavailable
- How to embed .mp4 videos in a WordPress post?
- How to embed local video in a wordpress post
- How to make an embeded a Youtube video from custom field text responsive to screen size?
- How to put an external object into WordPress to that occupies most of the available space?
- Reusing header.php from Yii application