YouTube videos can easily be embedded into posts, pages and in widgets.
Embed with a URL
The fastest way to embed a YouTube video is to use the video URL from “Share this video” under the Share option. Only public and “unlisted” videos and playlists can be embedded; “private” videos will not embed.
The link will automatically convert into an embed and provide a live preview in your editor.
If the content can’t be embedded using the URL it loads the embed block in the block editor where you are given an option to try again or convert to a link.
In the classic editor it will be added as the URL if the content can’t be embedded.
The link must be on its own line without any characters or whitespaces before or after the URL and must not be hyperlinked (clickable when viewing the post) otherwise it won’t embed.
Using Embed Code
You can also embed videos using their embed code.
This is handy when you want to change the size of the video embed or change the start time of the video.
Click on Share underneath the YouTube video you want to embed.
Now click on Embed.
Copy the embed code.
Add a custom HTML block if you are using the block editor.
To add custom HTML block you click on the + icon at the right of any empty block or at the top left of the editor then search for HTML and click on the custom HTML block icon.
Here’s what it looks like when it’s added to the Block Editor.
Paste the embed code into the custom HTML block.
Click on Preview to view the video.
Your Add Media button on your classic editor is used to add embed code to a post or page.
Place your cursor where you want the the video to appear and then click on the Add Media button.
In the Add Media window click on the Insert Embed Code tab.
Paste the video embed code into the embed code field.
Click on Insert into Post.
Your Add Media window will close and video will appear as an embed.