Embed YouTube video to the post or page

When you trying to input to the post the HTML code for the video from YouTube you may discover that it’s removed from the content after you save your changes. This is the WordPress HTML filtering security feature in action.

To embed a YouTube video into a post or page, place its URL into the content area. Make sure the URL is on its own line and not hyperlinked (clickable when viewing the post).

For example:

Check out this cool video:


That was a cool video.

Read this article from WordPress Codex for more information.

In general WordPress removes “unallowed” HTML tags from the user content. ‘unfilterd_html’ user capability may switch off this security measure for single site WordPress configuration. You have to turn on ‘Enable “unfiltered_html” capability’ option at the “User Role Editor Pro” options page for the WordPress multisite though:

WordPress multisite blocks this capability by default for all users except superadmin. That’s why this option was added to the “User Role Editor”.
Warning! Do not use this option if you have untrusted users between your authors. Be careful and double think before enable it. This makes your site potentially vulnerable.