Last updated May 13th, 2016 at 04:39 pm
Here are the basic tried-and-true steps for embedding a YouTube video into a WordPress Blog post or page, as of this writing. It also applies to embedding videos from several other video servers.
Method #1: The Original Way: Embed Code
Prior to version 2.9 of WordPress, this was how you had to do it. This method still works, and it arguably gives you the most control over how a video renders on the page.
- Click the “Share” button under the video at YouTube.
- Click the “Embed” button. This opens up a bunch of choices.
- You can choose any of the dimension sets whose width is less than or equal to the maximum width for your Blog’s layout. Alternatively, you can enter that width in the “Width” box in the “Custom” section. The appropriate height dimension will be entered automatically.
- You can leave all the checkboxes (“Show suggested…”; “Use HTTPS…”, etc.) unchecked.
- Copy (to your clipboard) the embeddable code in the box. It begins with “<iframe…”.
- Now go to your blog entry and edit it.
- (This is important:) Click on the HTML tab. Paste the code from your computer clipboard into your post where you want the video to appear. (It won’t work if you paste it into the edit box while in Visual mode.)
- Save/update the post, and Voila!
Method #2: The New Way: Just the URL!
WordPress – since version 2.9 – can take a standard URL of a video on any of several supported video servers (16 at this writing) and automatically convert it to the appropriate embed code. To use this method, do be sure to enable “Auto-embeds” in Administration > Settings > Media SubPanel.
Using this method, here’s what you’d enter…
…to get this…
Method #3: The Shortcode Way
You can wrap the URL in the WordPress “embed” shortcode. This will have the same result as Method #2, with a few differences:
- the URL does not have to be on its own line
- the “Auto-embeds” setting need not be enabled
- you can slightly customize the video by setting a maximum (but not fixed) width and height; e.g.,
[embed width="123" height="456"]...[/embed]
If you want, check out the official WordPress Codex page about Embeds.