Embed YouTube Videos in WordPress [How-To]

If you are trying to embed YouTube videos in WordPress and can’t figure out how to do that, then you are at the right spot. Adding YouTube or other videos to your blog post is very important to make it attractive and this guide will let you know how to do that.

There are two parts to this story. First of all, if you are the admin of your blog and are looking for the way to embed videos, it is easy to do that but if you are looking for a way to let your Authors do that, then there are two solutions for you, it is easy but you would need to do some tweaks before that works.

Embedding YouTube Videos – For Admins, Editors

By admin and editor, I mean the inbuilt user roles assignable to your writers. All you have to do is copy the embed code from YouTube or any other video sharing site and switch to the HTML editing mode. You can find it at the right top corner of the post editor. After switching to the HTML editor, you can see your post displayed in the HTML mode. Just drop in the code where you want the video to appear and click preview to see if the video is showing up [It will !].

Related: How To: Download Audio From YouTube Videos


Embedding YouTube Videos – For Authors

For letting your users add unfiltered HTML, which is necessary for adding any embed codes, the admin of the site should grant them special permissions. There are two ways  in which you could do that.

#1 Manual Way

  1. Open the functions.php file of your theme [Appearance -> Editor]
  2. Add the following code to it.

[php] $role = get_role( ‘author’ );

$role->add_cap( ‘unfiltered_html’ );[/php]

You are done. Now your authors can add unfiltered HTML (read: add videos) to their posts. But don’t do this unless you trust your authors because, now they can add any malicious script they want to. You don’t want that to happen do you ?

#2 Plugin

  1. Download, Install and activate the plugin Capability Manager.
  2. Go to Users -> Capabilities.
  3. Select the Author role from the sidebar and check the check-box that says Unfiltered HTML.
  4. Click Save Changes to save it.

Now your authors can embed videos without any problem. But as stated before, make sure you trust all your authors.

You can also use various plugins that help authors without the required permissions to add videos to their posts. We’ve compiled the 5 useful video plugins for wordpress, don’t forget to check it out.

Hope this guide helped you to do what you were looking for. If you have any doubts in the process, do let us know and we’ll be happy to help you out. There are many alternatives to capability manager, you can choose your own, all of them does the same job.

[stextbox id=”info”]Links[/stextbox]

Download Capability Manager