how to embed a youtube video in wordpress featured

How To Embed A YouTube Video In WordPress

Since the release of WordPress 4.0, it is now easier than ever before to embed YouTube videos on your website and in this tutorial, I will show you how to embed them on your WordPress site.

Method 1

Navigate to YouTube and select the video you wish to embed on your site.

YouTube video with highlighted URL

Highlight and copy the entire URL, as shown in the image above (do not use the short link) in the top navigation bar.

Then in your visual editor tab, put your cursor in the place that you wish your video to appear and then simply paste the URL.

WordPress visual editor tab with sample text

Once you have pasted the link, the video will automatically be embedded into your page or post and you will be able to see it right in the visual editor.

YouTube Video Customizations

Using the above method, the video will be embedded in the default size and layout, however, with a few tweaks to the code, you will be able to change the height and width, the alignment as well as having the option of removing related videos shown at the end.

To change the default settings you would add the following to the end of the code:

  • Height – &h=put a number here
  • Width – &w=
  • Height & Width – &h=number&w=number
  • Alignment – &align=left or &align=right
  • Hide Top Info Bar – &showinfo=0
  • To Disable Related Videos – &rel=0


To change height and width, your code would look like this (without the parenthesis)

( )

Video Start & End Times

You can even indicate at what point the video will start and end.

To do this, you will have to convert the minutes into seconds.


In this example, the video will start at the 1-minute point.

( )

In this example, the video will start at 1 minute and end at 2 minutes.

( )

Potential Problems With This Method

While this is a very easy method, there have been instances where the video doesn’t display properly on certain themes.

For example, on my theme, I have issues with selecting the start and end times and also with the video displaying in widgets.

If that is the case with your website, then on to method 2

Method 2

The following is the method that I have been using for years and is still my preferred method.

First, navigate to the YouTube video of your choosing.

Under the video, click the share link, then embed and lastly, the show more link as in the image below.

YOuTube share feature

This will reveal a preview of the video with a drop-down menu to change the size and several customizations that you can toggle on or off.

YouTube video embed preview

Once you have made your preferred selections, copy the entire embed code from the box at the top as shown in the image above.

Next, you will need to paste the code into the text portion of your WordPress editor.

WordPress editor text tab

Simply click the text tab and scroll to the area that you would like the video to appear to paste the code.

Some people like to type a series of X’s in their visual tab before doing this so they can find the area much easier.

Click the save draft button and your video is now embedded.

How To Center The Video

After pasting the code in this method, the only tweak that I normally like to do is to make sure the video will display centered on the page.

To do this, you would place  <center> before the embed code and </center> after the code.


<center>YouTube code goes here</center> without any spaces.

How To Add A Video To The Sidebar

To add a video to the sidebar of your website, you will have to size the video smaller as the default sizes are usually too large.

Follow the instructions for method 2, however, when you see the drop-down menu for the video size, select Custom Size.

You will notice that 2 boxes have appeared.

YouTube custom size settings

When you type a dimension into the left box (width), the box on the right will automatically calculate the height once you click the cursor into it.

The exact size you will need for the sidebar will vary depending upon your theme so, a little trial and error may be in order.

Once you have copied the code then, in your WordPress dashboard, navigate to Appearance -> Widgets and select a text widget and add it to your sidebar.

WordPress text widget

Give the widget a title if you wish and paste the code into the content box as shown in the image above.

Be sure to use the code to center the video and click save.

You can then click and drag the widget to whatever position you wish it to appear on your sidebar.

YouTube video embedded into a WordPress text widget

You now have a YouTube video embedded in the sidebar of your website.


You can get all the latest WordPress training at Wealthy Affiliate as well as learning how to use videos in your marketing efforts.


Need Any Help?

I hope you have found this information useful. If so, feel free to share it with your friends and if you have any questions or comments, please leave them in the area below.

To Our Success!!

Leave a Comment

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