Posted on

How to Add YouTube Videos to Your WordPress Posts the Right Way

WordPress embeds – use them folks!

Old habits die hard, especially if no one told you there was a better (easier) way of doing things. Before WordPress 2.9, released in December 2009, if you wanted to add a YouTube video to your post you had two options:

  • Copy entire video embed code, paste it to your post while in HTML view or
  • Use a plugin that lets you paste just video ID, or some other part of its URL either into a special field or shortcode

I probably would never even write this post had I not received several emails lately, all from tech-savvy site owners, asking me why contributors are unable to add YouTube embed code to posts. The answer to the question is actually quite simple – contributors can’t add any kind of HTML to posts, but the fact such question was asked meant two more people unaware of this great WordPress feature.

So, if you wanted to embed a YouTube video, instead of doing this:

<iframe width="640" height="480" src="//" frameborder="0" allowfullscreen></iframe>

All you need to do is paste YouTube video URL on its own line, and the video gets embedded automatically:

Works with videos hosted at Vimeo, Viddler, Hulu,, DailyMotion, and as well. But that’s not where it stops. You can also embed Tweets:

Instagram photos:

#Fiat #piano #Porto

A post shared by Slobodan Manic (@slobodanmanic) on

And lots of other services. Other than convenience, there’s two major reason why you should do it this way:

  1. It’s how WordPress expects you to do it, meaning this is 100% future proof and
  2. If YouTube ever changes its embed code you’ll have to check each post and update the code, not a potential problem you’ll have to think of if you’re using nothing but URL, which is very unlikely to change

Yes, you can still use a plugin, paste video URL into it and let it embed a video for you, but as Occam’s razor states, all other things being equal simplest solution is almost certainly the best one and this is no exception. So how do you embed your videos?

Free Marketing Updates
Get the best marketing practices in your inbox.
We always respect your privacy.

Slobodan Manic
I love working with WordPress and doing it the right way. Themes and plugins I develop have a common #1 goal: Keeping it as simple as possible for users to publish their content.
Slobodan Manic


Web consultant with 10 years of experience in web development and web analytics.
Slobodan Manic
Slobodan Manic

Latest posts by Slobodan Manic (see all)

4 comments How to Add YouTube Videos to Your WordPress Posts the Right Way

  1. Thank you for the post.

    When the embed feature is used to add the video what are the dimensions (width and height) of the video? is there a way to fix the dimensions?


  2. Thank you for the post.

    I wanted to add captions to the video in the WordPress posts. Is that possible without a plugin?

    Thanks in advance.

  3. That’s the easy part. After three month of posting including videos, I discovered that in the email that WordPress sends to subscribers, no indication is given that any video had ever been included. This is unacceptable for me. Do you have a solution? Thank you.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.