Default WYSWYG content editor in wordpress does not allow iframe tags. I think iframe tag was not included in the default WYSWYG because it is not advisable to get contents directly from other websites. But for some reason we have to add iframes to our post. And it is a pain not to add it directly like other tags that is provided by the default wordpress WYSWYG content editor. As a web developer of course it is possible to add by modifying the files inside the plugin files or we can add it also in our themes files php. In my case i add it in my admin-init.php from my theme that i used in the wordpress.
This is the block of code i added:
[php]
//sherkspear
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’);
[/php]
Nice post…Thank you for sharing some good things!!
[…] How to add iframe tags in wordpress WYSWYG content editor […]
After you have added the block of codes i posted above then you are good to go on using iframe tags in your WYSWYG. Shift to HTML view of your WYSWYG editor and start adding iframe tag on it with your parameters.
wonderful share, great article, very usefull for me…thanks
Thanks for this
information
Your welcome!!!
Well where i have to add that code ? in what php file ? looks like you added to admin-init.php, well i don’t have that file on my theme.