• Resolved kivgaen

    (@kivgaen)


    I am currently using wordpress version 2.8 with tinymce-advanced version 3.1. I wrote a tool for our bloggers to use that basically works like the Tinymce-advanced “emotions” button. The user clicks on their choice from the pop-up window, and then I insert some pre defined code into the WYSIWYG editor.

    I had to make a modification to my wordpress in order for the WYSIWYG editor to recognize the “iframe” element. I found the following line in the file wp-includes/js/tinymce/tiny_mce_config.php

    // Add external plugins and init
    $content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});';

    And I changed it to:

    // Add external plugins and init
    $content .= $ext_plugins . 'tinyMCE.init({extended_valid_elements : "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]",' . $mce_options . '});';

    Before I updated my wordpress, this solution was working.

    Now that I am running wordpress 2.8, this solution is no longer working. The “iframe” element keeps disappearing inwordpress 2.8.

    How can I make it so that I can insert an iframe into my blog without the WYSIWYG editor stripping it out?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter kivgaen

    (@kivgaen)

    I just wanted to add — is there any plugin that works with 2.8 that will make an iframe a legitimate tag in wordpress WYSIWYG editor?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    function add_iframe($initArray) {
    $initArray['extended_valid_elements'] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]";
    return $initArray;
    }
    
    add_filter('tiny_mce_before_init', 'add_iframe');

    That bit of code should do the trick, I think. Try it in your theme’s functions.php file, or create a plugin and put that in it.

    Thread Starter kivgaen

    (@kivgaen)

    I think that did the trick. Thanks, Otto!

    Thank you! I added the function and now I can insert the very cool gpsies maps into my posts.

    I tried putting the code in my functions.php file and it solved the iframe problem disappearing, but then i kept getting this error on lots of pages:

    Warning: Cannot modify header information – headers already sent by (output started at /…./functions.php:12) in /…./wp-includes/pluggable.php on line 868

    I’ll keep messing with it. Thanks for the push forward.

    @otto42 You rock!

    @lambwarren Maybe you have some extra spaces or line-breaks after the closing ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WordPress 2.8 – no more iframe?’ is closed to new replies.