Missed the news last week or so, but Twitter added oEmbed provider support to their API. While previous methods have existed to easily post tweets (such as Blackbird Pie), oEmbed is built into the WordPress core.
However, since Twitter didn’t implement oEmbed discovery, and WP has discovery off by default anyway, you have to resort to a small bit of code to make it work. Here’s that bit of code:
add_filter('oembed_providers','twitter_oembed'); function twitter_oembed($a) { $a['#http(s)?://(www\.)?twitter.com/.+?/status(es)?/.*#i'] = array( 'http://api.twitter.com/1/statuses/oembed.{format}', true); return $a; }
Here’s what happens when you put that code in a plugin (for example) and just paste a twitter URL into a post:
@otto42 Led Zeppelin can 😛 RT @otto42 Even Google knows that one does not simply walk into Mordor.
— Bad †Friday (@NephilimGhost) December 21, 2011
It handles RT’s pretty neatly, I think. 🙂
This may make it into WordPress by default in the next version. Too bad they came out with it too late for inclusion in WordPress 3.3.