Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaeluno/1d1c330f78a9957a1f16 to your computer and use it in GitHub Desktop.
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.
<?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