https://buy-zithromax.online buy kamagra usa https://antibiotics.top buy stromectol online https://deutschland-doxycycline.com https://ivermectin-apotheke.com kaufen cialis https://2-pharmaceuticals.com buy antibiotics online Online Pharmacy vermectin apotheke buy stromectol europe buy zithromax online https://kaufen-cialis.com levitra usa https://stromectol-apotheke.com buy doxycycline online https://buy-ivermectin.online https://stromectol-europe.com stromectol apotheke https://buyamoxil24x7.online deutschland doxycycline https://buy-stromectol.online https://doxycycline365.online https://levitra-usa.com buy ivermectin online buy amoxil online https://buykamagrausa.net

WordPress and iframes and YouTube (oh my!)

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 …

… 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.

It turns out that the TinyMCE editor (what’s there on the WordPress pages) will filter HTML elements that it doesn’t understand when you swap back and forth between Visual and HTML mode. So you can embed the iframe element while in HTML mode, but as soon as you hop back to Visual mode, TinyMCE gets rid of it.

(That annoying behavior is part and parcel of something that’s sometime useful, e.g., TinyMCE will also get rid of unmatched HTML closing tags, like /div, when you paste in and edit stuff.)

This is apparently a “known” problem. Presumably it’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’s through plug-ins that add various shortcodes, or various tricks using custom fields, or …

Well, that just strikes me as silly (and planned obsolescence if those plug-ins fail to be updated).

Sure, YouTube for the moment still has an option to use the old object code, but I kind of like the idea of including an iframe instead.  YouTube is pushing the iframe solution 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).

So with a bit more digging, I found a more elegant solution in the TSL iframe unfilter plugin, which essentially just tells the TinyMCE to not filter out iframe and its elements. Woot!

Plus I updated the plug-in per this post to keep it from conflicting with other unfilter plugins (which I don’t have, but which makes perfect sense).

So, anyway … for those who have any idea of what I’m talking about, hope this was of value and/or interest.

429 view(s)  

2 thoughts on “WordPress and iframes and YouTube (oh my!)”

Leave a Reply

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