Last active
January 3, 2016 13:49
-
-
Save tomjn/8471662 to your computer and use it in GitHub Desktop.
Fixes oEmbedding tweets after Twitter's changes in Jan 2014. To use, download by clicking the "Download Gist" button below, upload to your WordPress site and activate. You will then need to re-save any posts edited or published since the 17 January.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "cftp/twitteroembed-hotfix", | |
"description": "Fixes oEmbedding tweets after Twitter's changes in Jan 2014", | |
"license": "GPL-2.0+", | |
"type": "wordpress-plugin", | |
"authors": [ | |
{ | |
"name": "Tom J Nowell", | |
"email": "[email protected]", | |
"homepage": "http://tomjn.com" | |
}, | |
{ | |
"name" : "Code For The People", | |
"homepage": "http://codeforthepeople.com/" | |
} | |
], | |
"require": { | |
"composer/installers": "~1.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Twitter OEmbed Hotfix | |
Description: Fixes oEmbedding tweets after Twitter's changes in Jan 2014 | |
Author: Tom J Nowell | |
Version: 1.0 | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
add_filter( 'oembed_providers', 'twitter_hotfix' ); | |
function twitter_hotfix( $providers ) { | |
$providers['#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i'] = array( 'https://api.twitter.com/1/statuses/oembed.{format}', true ); | |
return $providers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment