WordPress.org

Ready to get started?Download WordPress

Forums

iframe and embed code (5 posts)

  1. xaoswolf
    Member
    Posted 3 years ago #

    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?

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    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).

  3. webvitaly
    Member
    Posted 3 years ago #

    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.

  4. RamTheSunlover
    Member
    Posted 2 years ago #

    @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?
    Thanks!

  5. Michael Mann
    Member
    Posted 2 years ago #

    @RamTheSunLover You might try <div style="display:block;width:100%">[iframe]</div>

Topic Closed

This topic has been closed to new replies.

About this Topic