Last active
August 29, 2015 14:11
-
-
Save michaeluno/1d1c330f78a9957a1f16 to your computer and use it in GitHub Desktop.
A Fetch Tweets extention WordPress plugin that disables the content security policy warningss caused by widgets.js, the script provided by Twitter.com.
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: Fetch Tweets - Disable Content Security Policy Warning | |
Plugin URI: http://en.michaeluno.jp/admin-page-framework | |
Description: Disables the content security policy warnings caused by widgets.js, the script provided by Twitter.com. | |
Author: Michael Uno | |
Author URI: http://michaeluno.jp | |
Version: 1.0.0 | |
Requirements: PHP 5.2.4 or above, WordPress 3.3 or above. Admin Page Framework 3.0.6 or above | |
*/ | |
class FetchTweets_DisableContentSecurityPolicyWarning { | |
public function __construct() { | |
add_action( 'wp_head', array( $this, 'replyToAddHeadTagElements' ) ); | |
} | |
/** | |
* Called when the head tag is rendered. | |
*/ | |
public function replyToAddHeadTagElements() { | |
echo '<meta name="twitter:widgets:csp" content="on">'; | |
} | |
} | |
if ( ! is_admin() ) { | |
new FetchTweets_DisableContentSecurityPolicyWarning; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment