December 28th, 2012 at 10:18 pm by Dr. Drang
A few days ago I was searching my site for something and landed on this page about archiving tweets with IFTTT. It didn’t have what I was looking for, but as I was looking through it, I saw that the extract of my archive was formatted wrong. Instead of looking like this,
it looked like this.
I assumed that WordPress was embedding tweets because of the Twitter URLs (this was correct) and that I’d find some switch in the WP admin pages to turn this off (this was incorrect). When I couldn’t find any such switch and my initial Google searches came up empty, I asked for help on Twitter and started digging through the WordPress source code.
I soon learned that this behavior goes by the name “auto-embed” or “oEmbed,” and that its functionality can be found—in part, at least—in
wp-includes/class-wp-embed.php. The best explanation of what had happened to my post is found on this page in the WordPress Codex, where I learned that this behavior has been around since WP 2.9, and that it works this way:
All you need to do to embed something into a post or page is to post the URL to it into your content area. Make sure that the URL is on its own line and not hyperlinked (clickable when viewing the post).
The tweet URLs that were turning into embedded tweets were, in fact, on their own lines. But why hadn’t I run into this before? The Codex had the answer to that, too:
As of 3.5, Auto-embeds are automatically enabled and there is no setting to turn them off in the WordPress admin pages. Prior to 3.5, there was an “Auto-embeds” checkbox in Administration > Settings > Media SubPanel.
Apparently I had that option turned off back when it was still possible to do so. I have no memory of fiddling with any such checkbox—maybe it was off by default.
At this point, I had a explanation for the behavior, but no way to change it back to the way it was. Fortunately, friend of ANIAT Matt McVickar (who goes by the extra-long, reply-limiting handle @matthewmcvickar), came to my rescue by pointing me to this suggestion, which led to this plugin. I copied the code, saved it in a file called
auto-embeds-disabler.php in the
wp-content/plugins directory, and activated it in the WordPress Plugins admin panel. Soon my site was back to normal.
I, however, was not back to normal. I was pissed. Auto-embedding (which also works for Flickr, YouTube, and other media sites) is the kind of behavior that belongs in a plugin, and here I was, forced to install a plugin to get rid of it. Worse yet, the embedding was being done inside a
<pre><code> block, which ought to be considered sacrosanct.
It’s dumbfuckery like this, more than the promise of a faster-loading site, that makes a baked blog so appealing. How wonderful it would be to have a site that can’t be messed up by someone else’s stupid decisions. Only by my own stupid decisions. Which are legion. Which is why I’m still with WordPress. It’s more fun to be pissed at someone else than at yourself.