Embedding Videos in WordPress

Problem

Trying to add the embed code for something like YouTube or Vimeo gets stripped out by WordPress’s editor. On top of that, the standard embed option of leaving the URL to the website on a line of it’s own gets screwed up if you edit a published web page as the various text filters add the paragraph <p> </p> tags around the URL, meaning it’s no longer on the line on it’s own, and instead of being an embedded video it’s now

Fix v1 : Shortcode

If you simply want to embed videos from well known sites like YouTube, then you can use one of the plethora of WordPress plugins which use some sort of short code, like |YouTube#84631| to insert the embeded video.

Fix v2 : Allow the Embed Code

This process involves allowing the HTML tags used in the embed code into the HTML tab of the TinyMCE WordPress editor.

Step 1. Install the TinyMCE Valid Elements plugin.

Step 2. Add the following :

# embed
* allowfullscreen, allowscriptaccess, height, src, type, width

# iframe
* frameborder, height, marginheight, marginwidth, scrolling, src, width

# object
* embed, height, name, param, src, type, value, width

# param
* name, value

Step 3. Go to the video page and copy the embed code.

Step 4. Go to edit a page or post and do a [Shift] + Refresh [F5], this clears the browsers cache.

Step 5. Select the HTML tab of the page or post, scroll to the correct location and paste in the embed code.

Step 6. Preview the page and update or publish it if correct.

Note : When getting the embed code you may find the size of the embedded video is larger than the size of the theme’s column and you’ll have to use a smaller size.

About admin

Australian Network for Art and Technology [ANAT] e: [email protected] | ph: +61 8 8231 9037 www.anat.org.au | www.filter.org.au | www.synapse.net.au Twitter: __ANAT | Facebook: http://bit.ly/bF9fXl The Australian Network for Art and Technology (ANAT) is supported by the Visual Arts and Craft Strategy, an initiative of the Australian, State and Territory Governments; the Australian Government through the Australia Council, its arts funding and advisory body, and the South Australian Government through Arts SA.
This entry was posted in Articles. Bookmark the permalink.

Leave a Reply

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