I have a blog that I often need to insert iframes into posts for various reasons (don’t ask why just trust me!)
When I use the “visual” view to edit my posts the WYSIWYG constatantly strips out my iframes …
I know I can keep the iframes in the post if I use the “html” view and only view/save from the “html” view … however I’d really like to be able to use the normal WYSIWYG to edit my post without having to resort to the “html” view.
Is there anything I can do to disable this behavior? I’ve seen this post, that suggests editing wp-includes/js/tinymce/tiny_mce_config.php
, but I’d really rather avoid doing something like that that would likely just break in a upgrade!
If you don’t want to write your own code there is a plugin to allow embedding an
<iframe>
:Then just use the shortcode like this:
You can customize the filter of TinyMCE, see the following example for
<iframe>
s and other tags to use Google Maps inside TinyMCE.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/
I had to upgrade to wordpress 3.2.1 and then installed Embed Iframe
and it worked great.
The iframe tages were no longer removed when switching back and forth from html to Visual in wordpress.
In multisite environment every user other than superadmin get html filtering (because potential security vulnerabilities). Based on this you can add Add unfiltered_html Capability to editors.
If you don’t like to use an additional plugin for the shortcode solution, you can add something along these lines to your theme, plugin or functions.php to add it by hand. If neccessary you might need to add some more keys to the keys-array.
Then in your post page, usage would be like so:
I found that using the Fusion Editor plugin to build my pages in WordPress works well.
This video show how to use Fusion Builder (skip to 4:15 for the part about adding containers, coloumns, elements and code blocks): https://www.youtube.com/watch?v=UDyNsnB_COA
I click to add a container, then click add element, and then add a code block instead of a text block (text block will remove an iframe, but a code block will not). In my code block I paste my iframe code and publish. Works great and I don’t have to modify any PHP files!