{"id":19962,"date":"2011-01-28T16:34:32","date_gmt":"2011-01-28T23:34:32","guid":{"rendered":"http:\/\/hill-kleerup.org\/blog\/?p=19962"},"modified":"2011-01-28T16:34:56","modified_gmt":"2011-01-28T23:34:56","slug":"wordpress-and-iframes","status":"publish","type":"post","link":"https:\/\/hill-kleerup.org\/blog\/2011\/01\/28\/wordpress-and-iframes.html","title":{"rendered":"WordPress and iframes and YouTube (oh my!)"},"content":{"rendered":"<p><a href=\"https:\/\/hill-kleerup.org\/blog\/wp\/wp-content\/uploads\/2011\/01\/rube-goldberg.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-19963\" title=\"Rube Goldberg machine by Heath Robinson\" src=\"https:\/\/hill-kleerup.org\/blog\/wp\/wp-content\/uploads\/2011\/01\/rube-goldberg-237x300.gif\" alt=\"\" width=\"237\" height=\"300\" srcset=\"https:\/\/hill-kleerup.org\/blog\/wp\/wp-content\/uploads\/2011\/01\/rube-goldberg-237x300.gif 237w, https:\/\/hill-kleerup.org\/blog\/wp\/wp-content\/uploads\/2011\/01\/rube-goldberg.gif 350w\" sizes=\"auto, (max-width: 237px) 85vw, 237px\" \/><\/a>I was pasting in a YouTube embed on my blog today (yes, I did a fair amount of that today), and noticed that the embed code <a href=\"http:\/\/apiblog.youtube.com\/2010\/07\/new-way-to-embed-youtube-videos.html\">used <\/a><em><a href=\"http:\/\/apiblog.youtube.com\/2010\/07\/new-way-to-embed-youtube-videos.html\">iframe<\/a> <\/em>rather than <em>object<\/em>.  Interesting.  I tried it out &#8230;<\/p>\n<p>&#8230; and then it disappeared from my edited post. Not just simply not showing up on the Visual part of the WordPress editor, but the code actually vanished.<\/p>\n<p>It turns out that the TinyMCE editor (what&#8217;s there on the WordPress pages) will filter HTML elements that it doesn&#8217;t understand when you swap back and forth between Visual and HTML mode.  So you can embed the <em>iframe <\/em>element while in HTML mode, but as soon as you hop back to Visual mode, TinyMCE gets rid of it.<\/p>\n<p>(That annoying behavior is part and parcel of something that&#8217;s sometime useful, e.g., TinyMCE will also get rid of unmatched HTML closing tags, like \/div, when you paste in and edit stuff.)<\/p>\n<p>This is apparently <a href=\"http:\/\/www.google.com\/search?sourceid=chrome&amp;ie=UTF-8&amp;q=wordpress+iframe\">a &#8220;known&#8221; problem<\/a>.  Presumably it&#8217;s somewhere out there as a request for WP development, but in the meantime the community has come up with a number of ways to get around the problem (besides not hopping over to the Visual tab, ever, when editing with iframes). In most cases it&#8217;s through plug-ins that add various shortcodes, or various tricks using custom fields, or &#8230;<\/p>\n<p>Well, that just strikes me as silly (and planned obsolescence if those plug-ins fail to be updated).<\/p>\n<p>Sure, YouTube for the moment still has an option to use the old <em>object <\/em>code, but I kind of like the idea of including an iframe instead. \u00a0YouTube is <a href=\"http:\/\/techie-buzz.com\/tech-news\/youtube-iframe-embed-tags.html\">pushing the iframe solution<\/a> as their preferred way of embedding video into websites. This lets you utilize their new enhanced player, which works better between HTML5 and Flash and so forth (including on non-Flashy Apple products).<\/p>\n<p>So with a bit more digging, I found a more elegant solution in the <a href=\"http:\/\/wordpress.org\/extend\/plugins\/tsl-iframe-unfilter\/\">TSL iframe unfilter<\/a> plugin, which essentially just tells the TinyMCE to not filter out <em>iframe <\/em>and its elements.  Woot!<\/p>\n<p>Plus I updated the plug-in per <a href=\"http:\/\/wordpress.org\/support\/topic\/plugin-tsl-iframe-unfilter-resolving-tinymce-unfilter-conflicts\">this post<\/a> to keep it from conflicting with other unfilter plugins (which I don&#8217;t have, but which makes perfect sense).<\/p>\n<p>So, anyway &#8230; for those who have any idea of what I&#8217;m talking about, hope this was of value and\/or interest.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was pasting in a YouTube embed on my blog today (yes, I did a fair amount of that today), and noticed that the embed code used iframe rather than object. Interesting. I tried it out &#8230; &#8230; and then it disappeared from my edited post. Not just simply not showing up on the Visual &hellip; <a href=\"https:\/\/hill-kleerup.org\/blog\/2011\/01\/28\/wordpress-and-iframes.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WordPress and iframes and YouTube (oh my!)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":19963,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[55],"tags":[],"class_list":["post-19962","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogging-technical"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/hill-kleerup.org\/blog\/wp\/wp-content\/uploads\/2011\/01\/rube-goldberg.gif","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2693,"url":"https:\/\/hill-kleerup.org\/blog\/2002\/05\/16\/poll_position.html","url_meta":{"origin":19962,"position":0},"title":"Poll position","author":"***Dave","date":"Thu 16-May-02 10:20am","format":false,"excerpt":"So I've picked up a clever micro-polling widget that I can embed in my posts ... in theory, at least. Does it work? () I'm not sure what I'll use...","rel":"","context":"In &quot;Blogging &amp; Internet&quot;","block_context":{"text":"Blogging &amp; Internet","link":"https:\/\/hill-kleerup.org\/blog\/category\/blogging"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24294,"url":"https:\/\/hill-kleerup.org\/blog\/2011\/12\/07\/things-id-like-to-see-from-google-plus.html","url_meta":{"origin":19962,"position":1},"title":"Things I&#39;d like to see from Google Plus","author":"***Dave","date":"Wed 7-Dec-11 10:25am","format":false,"excerpt":"1. Some API means to feed into it. Come up with some sort of throttle or control to keep it manageable, if you want, Google, but trying to make Plus the equivalent of Facebook in being the Center of the Universe is not an attractive idea.2. I'd like to be\u2026","rel":"","context":"In &quot;~PlusPosts&quot;","block_context":{"text":"~PlusPosts","link":"https:\/\/hill-kleerup.org\/blog\/category\/blogging\/plusposts"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12961,"url":"https:\/\/hill-kleerup.org\/blog\/2008\/08\/29\/feeds_and_pictures.html","url_meta":{"origin":19962,"position":2},"title":"Feeds and pictures","author":"***Dave","date":"Fri 29-Aug-08 11:56pm","format":false,"excerpt":"It's educational looking at my\u00a0own web feed via Google Reader. Given that I suspect the majority of my readers depend on an RSS\/Atom feed of my blog (rather than browsing...","rel":"","context":"In &quot;Blogging - Technical&quot;","block_context":{"text":"Blogging - Technical","link":"https:\/\/hill-kleerup.org\/blog\/category\/blogging\/blogging-technical"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":188,"url":"https:\/\/hill-kleerup.org\/blog\/2003\/06\/02\/the_muse_demand.html","url_meta":{"origin":19962,"position":3},"title":"The Muse demands her due","author":"***Dave","date":"Mon 2-Jun-03 3:40pm","format":false,"excerpt":"After bitching last week about my quotations database, my Muse decided she'd had about enough on the subject. (You've probably had enough on the subject, too, but she has 24x7...","rel":"","context":"In &quot;Quotations (WIST)&quot;","block_context":{"text":"Quotations (WIST)","link":"https:\/\/hill-kleerup.org\/blog\/category\/blogging\/wist"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":18587,"url":"https:\/\/hill-kleerup.org\/blog\/2010\/09\/15\/geek-gamer-girls.html","url_meta":{"origin":19962,"position":4},"title":"Geek &#038; Gamer Girls","author":"***Dave","date":"Wed 15-Sep-10 10:58pm","format":false,"excerpt":"I was lucky enough to marry one ... EMBED-Geek and Gamer Girls Song - Watch more free videos Kids these days have it sooooooo easy ... (via Les)","rel":"","context":"In &quot;Comics &amp; Comic Books&quot;","block_context":{"text":"Comics &amp; Comic Books","link":"https:\/\/hill-kleerup.org\/blog\/category\/media\/media-comics"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":160325,"url":"https:\/\/hill-kleerup.org\/blog\/2024\/01\/01\/111678647900126640.html","url_meta":{"origin":19962,"position":5},"title":"The Unbearable Lightness of Being Kim Jong Un","author":"***Dave","date":"Mon 1-Jan-24 1:10am","format":false,"excerpt":"\"People aren't paying attention to me? How rude! Better make some new threats!","rel":"","context":"In &quot;~Toots&quot;","block_context":{"text":"~Toots","link":"https:\/\/hill-kleerup.org\/blog\/category\/blogging\/toot"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/posts\/19962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/comments?post=19962"}],"version-history":[{"count":0,"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/posts\/19962\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/media\/19963"}],"wp:attachment":[{"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/media?parent=19962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/categories?post=19962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hill-kleerup.org\/blog\/wp-json\/wp\/v2\/tags?post=19962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}