Wordpress - Make WordPress WYSIWYG not strip out iframe's
You can customize the filter of TinyMCE, see the following example for <iframe>
s and other tags to use Google Maps inside TinyMCE.
function fb_change_mce_options( $initArray ) {
// Comma separated string od extendes tags.
// Command separated string of extended elements.
$ext = 'pre[id|name|class|style],iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]';
if ( isset( $initArray['extended_valid_elements'] ) ) {
$ext = ',' . $ext;
}
$initArray['extended_valid_elements'] = $ext;
// Maybe, set tiny parameter verify_html
//$initArray['verify_html'] = false;
return $initArray;
}
add_filter( 'tiny_mce_before_init', 'fb_change_mce_options' );
Add this to an custom plugin or functions.php of the theme. Also you can read more informations in my post: http://wpengineer.com/1963/customize-wordpress-wysiwyg-editor/
If you don't want to write your own code there is a plugin to allow embedding an <iframe>
:
- Embed IFrame Plugin for WordPress
Then just use the shortcode like this:
[iframe http://example.com 400 500]