Created
March 12, 2013 16:09
-
-
Save cfg/5144185 to your computer and use it in GitHub Desktop.
Remove WordPress JetPack notifications.
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 | |
/** | |
* Disable JetPack notifications which throw errors in Chrome: | |
* Unsafe JavaScript attempt to access frame with URL https://public-api.wordpress.com/rest/?notes_iframe=jetpack#http://example.com/wp-admin/edit.php?mode=excerpt from frame with URL http://bgrwp.cfgdev.com/wordpress/wp-admin/edit.php?mode=excerpt. The frame requesting access has a protocol of 'http', the frame being accessed has a protocol of 'https'. Protocols must match. | |
* | |
* @author Corey Gilmore <corey@bgr.com> | |
* | |
*/ | |
function x_remove_jetpack_notifications() { | |
if( defined( 'DOING_AJAX' ) && DOING_AJAX ) | |
return; | |
if( !has_filter( 'show_admin_bar', '__return_true' ) && !is_user_logged_in() ) | |
return; | |
if( !class_exists('Jetpack_Notifications') ) | |
return; | |
$notes = Jetpack_Notifications::init(); | |
if( $priority = has_filter( 'admin_bar_menu', array( &$notes, 'admin_bar_menu') ) ) | |
remove_action( 'admin_bar_menu', array( &$notes, 'admin_bar_menu'), $priority ); | |
if( $priority = has_filter( 'wp_head', array( &$notes, 'styles_and_scripts') ) ) | |
remove_action( 'wp_head', array( &$notes, 'styles_and_scripts'), $priority ); | |
if( $priority = has_filter( 'admin_head', array( &$notes, 'styles_and_scripts') ) ) | |
remove_action( 'admin_head', array( &$notes, 'styles_and_scripts'), $priority ); | |
} | |
add_action( 'init', 'x_remove_jetpack_notifications', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment