How to embed YouTube videos in WordPress without plugins

Learn how to embed a YouTube video on your WordPress website

YouTube is one of the most widely known brands on the web, the video sharing site has surpassed viewership of the biggest TV networks anywhere in the world, even on mobile devices; recent statistics suggest that more than half of total views on YouTube come from mobile devices. That’s just another reason to optimize your WordPress sites for mobile, but also for the ability to scale mobile videos in your design. Video content has become big business, make sure you’re part of it.

Image Source: Screenshot –

Whether you are sharing your own video content, or are looking to complement your stories / content with videos that come from other sources, it’s vital that your WordPress blog supports easy video integration. Therefore, make sure that you display videos equally good for any type of device. Quite often people run into problems like videos having inappropriate dimensions and thus not displaying well for visitors. Embedding the right video format and size is important.

How to embed a YouTube video in WordPress

Video Channel
Image Source: JuralMin โ€“ / License: CC0 Public Domain

Luckily for WordPress webmasters and bloggers, WordPress comes equipped with a shortcode called embed. This literally allows you to embed any type of media from the web without having to use any extra plugins or code snippets. To simplify the process even more, WordPress core has built-in functionality that allows you to just share an URL of a video and it will automatically embed itself into the page. You can try to embed a YouTube video on your WordPress blog right now.

YouTube Link

This is a commercial video for our popular MH Magazine WordPress Theme:

As you can see, it converts automatically when posting the link to the video.

The idea here is very simple. You link to the video which you want to display in the post, and it will appear automatically. There really isn’t anything else to it. However, the only thing you may want to do is adjust the height and width dimensions of the YouTube video, and this can be done using the embed shortcode in WordPress. This video has been scaled down to 400 x 225px:

[embed width="400" height="225"][/embed]

The same video was displayed, only this time it was scaled down to the preferred height/width dimensions. And because the embed shortcode is universal in WordPress, you can apply any other tags; center, blockquote, code, and any other shortcodes you might be using on your site.

Making use of the YouTube embed code

What WordPress is doing with the embed shortcode is simplifying what YouTube already offers, the Share Embed feature. Each YouTube video has a tab underneath the title of the video that says Share, and upon clicking on this tab there is another tab that says Embed. Once you click on Embed, you will be presented with a piece of iframe code that you can directly copy/paste into your posts.

YouTube Embed
Embed YouTube Video – Screenshot

You have to click on the Show More tab to unfold all the options, especially if you want to select different video dimensions to use. That same feature panel will let you select additional features, such as whether to show player controls, or to display additional data like video title. You should also know that WordPress lets you embed from dozens of most popular video content sites in the world; see full list here. This gives you many possibilities to embed videos on your WordPress site.

Displaying YouTube videos with WordPress widgets

Another way of displaying YouTube videos in WordPress is by using a widget. You could either use a default WordPress Text widget and then use the WordPress embed shortcode or the YouTube embed code to add the video to the widget or you could check if your WordPress theme has included a suitable widget to display YouTube videos out of the box.

MH Magazine Demo 3

For example our very popular MH Magazine WordPress theme offers the MH YouTube Video widget which you can use to easily display YouTube videos in any of the available widget areas. Just copy & paste the watch code / video ID of the video into the widget and it will display your video right away.

YouTube WordPress plugins

Deactivate WordPress Plugins
Image Source: Clker-Free-Vector-Images โ€“ / License: CC0 Public Domain

The default method for embedding YouTube videos in WordPress is easy and simple enough for anyone to adapt to, but sometimes there are cases where you might want a little bit more customization options, as well as different ways to fetch different types of YouTube videos; such as playlists for example. For that, you can rely on numerous YouTube plugins that are available in the plugin repository. Whatever you’ve planned with video content, WordPress can make it happen.

Conclusion: Embed video content on your WordPress website

No matter how you decide to embed videos on your website, making use of video content can be highly beneficial for the success of your WordPress website. People love watching videos and it has become one of the most popular ways to consume online content. Are you already embedding video content on your website? What’s your favorite video platform? Or do you have any questions about embedding YouTube videos? Just let us know in the comments.

Share this with your friends


  1. Do you know where I can change the default size of the YouTube video when the video is embedded by just pasting the URL?

    • Hi Tobias, the size of the YouTube video usually will be the same as the content width of the WordPress theme you’re using. You can also modify the defaults by using a filter. As an alternative you could of course also use the embed code from YouTube and set the size as you like before you copy and paste the code.

    • Hi Peter, this is because inserting the YouTube URL into the MH YouTube Video widget is not the correct approach. Instead of the URL, you just need to insert the watch code / video ID. The video ID is part of the URL, for example: AvOTBFM_3RQ

  2. I’m not sure how to post a Youtube video to my website. I have HTML code as iframe and whenever I paste this into the WordPress editor, it disappears after saving the post. Is there anything I’m missing or do I really need to use this WordPress embed instead?

    • Hi Jimmy, if you want to post a YouTube video iframe with HTML, you need to switch the WordPress editor to Text mode. If you post code into the Visual editor, WordPress will usually strip the code. Here you can learn more about the editor: How to use the WordPress editor.

      In addition, if you’re using security plugins (e.g. Wordfence or else) on your WordPress website, then it’s also possible that these plugins strip code (e.g. iframe video) for security reasons. That means if posting the YouTube HTML code into the WordPress Text editor doesn’t work for you, then you could look into your installed plugins in order to find the culprit.

  3. I added a video to my website but WordPress posted the video in strange size. How can I change the Youtube video dimensions? I need a Youtube embed code example if possible. I’m not using one of your WordPress themes, but can you help me? Thanks.

    • Hi Gabriel, it’s very hard to answer your question without seeing your website or knowing what WordPress theme you’re using. But in general, if you’ve embedded the video correctly, it should be displayed accordingly. Unless your WordPress theme or something else on your website is affecting this. You could do some general troubleshooting in order to find the culprit.

      You can change the YouTube video dimensions by either using the embed options at YouTube and then copy & paste the correct embed code (iframe) or you could have a look at the WordPress embed shortcode. Please check the embed code example in our article.

  4. Great and informative article! I’m looking for a YouTube widget for my website but it seems I don’t have this included. Do I need a special YouTube theme for this or should it be available with other WordPress themes as well? Thanks for your help.

    • Hi Claudia, thanks – we’re very happy that you like the post. If your WordPress theme doesn’t have a YouTube widget included, then you could use a plugin for this purpose. We’ve linked a post with a few plugin suggestions in the article. You don’t need a special YouTube theme.

      If your website is a professional blog, online magazine or dynamic news site, you could also have a look at our popular MH Magazine theme. It’s one of the best and most popular magazine themes on the market and includes a YouTube widget to post a YouTube video out of the box. This magazine theme also shows a play button icon on thumbnails in widgets or archives to indicate posts with videos (if set as video posts). You can see this in some of the theme demos.

  5. Is there a way of adding a video post in the (home page) slider. I have created a video post but it shows a blank slide when active on the slide show (reason being there is no featured image).

    • Hi Eugene, it depends on your WordPress theme. If your (home page) slider is making use of featured images, you could have a look at plugins that replace the featured image with a video: How to add video thumbnails in WordPress.

      However, please keep in mind that this may negatively affect the performance of your website. As an alternative you could look into WordPress plugins that offer video sliders.

  6. I have a WordPress website where I publish videos on a daily basis. Is there a way to publish these videos automatically on social media (Facebook, Twitter, etc…) as well?

  7. Hello, It’s not a problem to embed YouTube videos either using WordPress or YouTube tags. My question is how to make sure that the size of the video does always fit the width of the screen (container) so it would work similar to the MH YouTube Video widget? Thank you.

    • Hi Andy, if you’re using our popular MH Magazine theme, you can put your video into a <div>-container with a special CSS class, like so:

      <div class="mh-video-container"><!--Your video embed code--></div>

      This will ensure that your embedded YouTube video will scale nicely across all widths.

  8. After struggling with this myself, in particular with the new HTML5 player, I’ve made a quick website ( to help you choose between all the options to embed a Youtube video. (It’s free) ๐Ÿ™‚

  9. Hi, is there a CSS code I can put in so all my YouTube video embeds fit the width of the screen? The width of the YouTube videos is limited at the moment. Thank you.

    • Hi Edin, you’ve currently embedded the YouTube videos with a maximum width of 640px. However, you could certainly scale the videos to full-width of the content area on your site with a line of CSS, for example:

      .youtube-player { width: 100%; }

Leave a Comment

Your email address will not be published.