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]
- 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
- Get first video from the post (both embed and video shortcodes)
- Replace audio/video enclosure with player?
- Modify youtube video size on one page and show another size on different page
- add_filter to youtube embeds?
- 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?
- How to change WordPress embedded player size or show just the play button
- 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
- Add a YouTube or Vimeo video as a post attachment?
- 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?
- 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
- How can I override print_embed_sharing_dialog() in WordPress 4.5
- How to set YouTube video as featured image?
- Extract an embedded video from the content
- pdf (25MB) – how to display and enable download?
- Is there a way to create embed codes from wordpress/buddypress content?
- 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 can I remove the first video from a post and feature it?
- WordPress block editor embeds not working in theme (single.php)
- YouTube Sidebar Widget – YouTube service unavailable
- How to embed local video in a wordpress post
- How to put an external object into WordPress to that occupies most of the available space?
- Reusing header.php from Yii application
- videos not showing on my tag pages
- How do I not embed the SoundCloud player? I just want the link
- Add Watermark to PDF’s of logged in user in WordPress upon upload to media library [closed]
- How can I embed an Excel spreadsheet that allows users to edit certain fields, but is still “read-only”
- Why is my get_post_meta not properly calling the custom field when attempting to embed a YouTube video?
- Help with jot form pro embed code
- Looking to Customize YouTube Video Embeds
- embed via wp_embed_register_handler only works in front-end
- Embed wikipedia page in WordPress?
- Embed post wont work on custom post type
- How to embed my latest WordPress post into an external page
- Embed video from streamtape using direct link
- Embed Microsoft Forms into WordPress page
- Video, embed, html block usage out of the_content
- Why most embed feature doesn’t work?
- How to (correctly) embed a Facebook video?
- Remove wordpress embed share icon?
- ‘[code]’ shortcode to markup programming code does not work
- My WordPress editor deletes all characters after emoji – how can I fix this?
- Do_Shortcode not working for Embed any tweet
- How to make Youtube short code transfer
- Increase size of Google Document Site Wide [closed]
- Choopy Video Playback in a popup using Artiss Youtube Embed [closed]
- iframe/embed vid in text widget loads outside container and moves around when scrolling the page?
- How to have embedded images from smugmug take full width of blog posts
- WordPress: embedding last posted video
- Enclosures being deleted “automatically”
- Fetching Video From YouTube Automatically [closed]
- Completely disable oEmbed and auto-embed on frontend and post editor?
- Embed links work on new page creation, not on edit