How to embed a YouTube Video in WordPress

Share this!

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.

  1. Click the “Share” button under the video at YouTube.
  2. Click the “Embed” button. This opens up a bunch of choices.
  3. 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.
  4. You can leave all the checkboxes (“Show suggested…”; “Use HTTPS…”, etc.) unchecked.
  5. Copy (to your clipboard) the embeddable code in the box. It begins with “<iframe…”.
  6. Now go to your blog entry and edit it.
  7. (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.)
  8. 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.

Share this!


The nSiteful Tech Blog (the official blog of nSiteful Web Builders, Inc. since January of 2013) is where I (Jeff Cohan) and (occasionally) associates will be posting articles of potential interest to like-minded techies, nSiteful clients who are playing active roles in the maintenance of their own Web sites and blogs, and pretty much anyone interested in how Web strategies and tools can help them reach their goals.

This entry was posted in Snippets and tagged , , by Jeff Cohan. Bookmark the permalink.

About Jeff Cohan

Jeff and his wife, Margie, are the proud parents of Sarah and Jake. Jeff is the founder, president and chief cook and bottle washer of nSiteful Web Builders, Inc., a Web development and Internet Consulting firm. In his spare time, Jeff builds Web sites and Web applications, plays guitar, putters around in his basement woodworking shop, mercilessly spoils his grandchildren, and creates videos from more than two decades of home movies. His current video project is an extended montage of people (mainly family members) asking him to stop filming them.

Leave a Reply

Your email address will not be published. Required fields are marked *