Twitter oEmbed not working in WordPress

On January 14th 2014 Twitter updated it’s API to force SSL on requests. This caused Twitter oEmbed API to not work in WordPress.

Despite there’s already a fix to this issue in trac you might want to fix this before an official update get’s live.

If so, here’s a snippet which you add to your functions.php ( originally published on github ) :

add_filter( 'oembed_providers', 'oembed_fix_twitter', 10, 1 );

function oembed_fix_twitter( $providers = array() ){
        $providers[ '#https?://(www.)?twitter.com/.+?/status(es)?/.*#i' ] = array( 'https://api.twitter.com/1/statuses/oembed.{format}', true );
        return $providers;
}

Note: You might have to update all posts where oEmbed failed previously (most like posts published since Jan 14th 2014 till today) as oEmbeds are being cached in post_meta table per post.

This fix is brought to you by Parade dev team.