How to paste iframe tags onto your posts

Do you have experience of embedded tags in Google maps or calendar that disappear when you paste in WordPress?

It’s caused by WordPress’s initial setting that removes iframe tags from your posts automatically.

Here’s an explanation of how to paste iframe tags onto your posts.
I tried this method in WordPress3.1.1.
(CAUTION: This method is your own responsibility)

METHOD:
Open the file
wp-content/themes/<your theme directory>/functions.php
and add the below code at the end of the file.

function extended_enable_elements($init) {
$init['extended_valid_elements']="iframe[src|width|height|name|align|style|scrolling|marginwidth|marginheight|frameborder]";
return $init;
}
add_filter('tiny_mce_before_init', 'extended_enable_elements');

Actually it may not completely show the frame in the view of “Visual-Editor”, but enough is shown in the “Preview” window.

If anyone who can find a way to show IFRAME in the “Visual-Editor” of WordPress then comments would be helpful.

View Larger Map

Share on Facebook
Post to Google Buzz
Bookmark this on Yahoo Bookmark
Bookmark this on Digg
Share on FriendFeed

This entry was posted in Wordpress. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>