I need to embed an iFrame into a post and it appears that tinyMCE or something is stripping it out when I go from HTML to Visual view while editing a post.

I've found instructions for adding valid elements to tinyMCE but it only seems to apply to WordPress 2.8. No such file seems to exist under WordPress 3.0.1 (see Make WordPress WYSIWYG not strip out iframe's)

None of the iFrame embedding plugins seem to support WP 3.0.1 either.

Thanks for any tips.


Did you try this solution: Make WordPress WYSIWYG not strip out iframe's?

  • That seems to have done the trick - must have missed this part - thanks! Just had to paste the following before the function to make it show up as a plugin: <?php /* Plugin Name: Change tinyMCE Options */
    – cpuguru
    Oct 29 '10 at 21:01

Copy paste this code in your functions.php :

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

This will add a filter to tinymce editor. Working on WP 3.xx


I use tinymce advanced plugin which has the option to not strip iframes in the settings panel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.