Embedding YouTube Videos in WordPress

Feb 20, 2015

Embedding YouTube Videos in WordPress

Feb 20, 2015

While you can upload a video and host it on your WordPress site, it is highly recommended that you do not do it. Videos can take up a lot of storage space and also providers like YouTube process the video to provide better quality.

A simpler approach would be to upload the videos to a popular video service provider like YouTube and then embed the video on your WordPress site. You can also embed existing videos in this approach. This article discusses embedding videos from YouTube, but other providers are supported as well.

Embedding YouTube Videos

The simplest way to embed a YouTube video is to paste the URL of the YouTube video onto the Visual editor of your post or page. For eg,https://www.youtube.com/watch?v=vjnaknNly8c is the URL, which needs to be pasted on a line by itself. You have to ensure that there is no other content on that line except the URL. Also you have to ensure that this line is not hyperlinked. You can now see a preview of the video in the Visual editor as follows:

adding video

You can add any other text or images and complete the post and publish it. As simple as that!

You can also add a video by using a shortcode as follows. This needs to be pasted on the text editor.



Again, you can see a preview of the video in the Visual Editor.

Customizing your video

The previous section described how you can embed a video by using a shortcode. You can customize the video display with the shortcode as well. Here are some examples:

– Customizing the size of the video

You can specify the height and/or width of the video with the “&h”=and “&w” variables. [youtube= https://www.youtube.com/watch?v=IM5geg1KWFI&w=320&h=240]

– Customizing the start and/or end time

You can specify the start and/or end time to play the video with the “start” and “end” variables and specify the time in seconds.

[youtube= https://www.youtube.com/watch?v=IM5geg1KWFIstart=75&end=85]

– To hide related videos from appearing after the video is done, use the variable “rel=0”

Videos can be added to the footer or sidebar as well, by pasting the shortcode onto a text widget.

A video can also be embedded in the comments section by simply pasting the URL.

It is also possible to stream a live broadcast using Youtube or Google hangouts air feature on your WordPress site.




Would love your thoughts, please comment.x