A lot sites are now using iframe for embedding video and other items. Any time I try to add the iframe code, it disappears right after I save if switch between the html and wysiwyg editors.
I normally just paste the code for into the html editor.
Am I doing something wrong, or is it not compatible?
Don’t switch between editors while editing a Post.
The Visual editor filters out IFRAME tags. You either need to use only the HTML editor when adding iframes, or else you need to hook a custom configuration into TinyMCE (the Visual editor).
WordPress removes iframe when you switch from “HTML” to “Visual” tab because of the security reasons. You can try iframe plugin. It will help you to embed iframe with this shortcode: [iframe width=”640″ height=”480″ src=”http://player.vimeo.com/video/3261363″] so now WordPress will not remove your iframe when you will switch from “HTML” to “Visual” tab in your editor.
@webvitaly your plugin works beautifully! Thank you.
I still have trouble, though, with text wrapping around the iframe. The only way I have found to prevent text wrapping around the iframe is to always use the width set at 100%, as is the default in the plugin (by the way just delete the height= parameter and the height will autoadjust to the height of the source, at least for Vimeo iframes).
But if I want the width to be less than 100%, the text always wraps up next to the iframe on the right side. I tried wrapping the iframe in div tags: <div> [iframe] </div>, but that does nothing to prevent the text wrapping.
I tried wrapping it in div + p tags: <div><p> [iframe] </p> </div> but the editor removes the p tags when switching back and forth between HTML and VISUAL.
Anyone know the solution to this?
- The topic ‘iframe and embed code’ is closed to new replies.