[wp-trac] [WordPress Trac] #20814: Add a couple other caveats for catching tweets for oEmbed
WordPress Trac
noreply at wordpress.org
Sun Oct 6 01:53:08 UTC 2013
#20814: Add a couple other caveats for catching tweets for oEmbed
-------------------------------------+----------------------
Reporter: georgestephanis | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: General | Version: 3.4
Severity: normal | Resolution: invalid
Keywords: needs-patch ux-feedback |
-------------------------------------+----------------------
Comment (by markjaquith):
I had a client run into this issue, and they were surprised it didn't
work.
First, this is primarily Twitter's problem. They're not recognizing that
URL. But I disagree with Nacin's assessment that it isn't a tweet link.
The image and the tweet are inseparable. There is a one-to-one
relationship between tweets and images on Twitter. Every image has one
tweet, and every tweet with an image has one image (you can't attach
multiple images). Instead, this URL acts as a different view on the
tweet/image combo (image large, tweet small).
The question for me is whether this poor user experience is worth it
because of some uncertainty we might have about Twitter eventually
supporting multiple images per tweet (that seems not very likely, given
the length restraints of the medium).
In the meantime, here's code to make it work:
{{{
function _wp_fix_twitter_oembed_url( $provider, $url ) {
if ( 'api.twitter.com' === parse_url( $provider, PHP_URL_HOST ) &&
strpos( $url, '/photo/' ) !== false ) {
$provider = remove_query_arg( 'url', $provider );
$url = preg_replace( '#/photo/.*$#', '', $url );
$provider = add_query_arg( 'url', urlencode( $url ),
$provider );
}
return $provider;
}
add_filter( 'oembed_fetch_url', '_wp_fix_twitter_oembed_url', 10, 2 );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20814#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list