Last active
June 2, 2020 06:18
-
-
Save westonruter/d168c290d6c01c107da960d48fa3dad3 to your computer and use it in GitHub Desktop.
[OBSOLETE] Update to Jetpack 8.4.2 to fix this issue.
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 | |
/** | |
* AMP Jetpack Admin Bar Workaround initialization file. | |
* | |
* @package AMP_Jetpack_Admin_Bar_Workaround | |
* @author Weston Ruter, Google | |
* @link https://gist.github.com/westonruter/d168c290d6c01c107da960d48fa3dad3 | |
* @license GPL-2.0-or-later | |
* @copyright 2020 Google Inc. | |
* | |
* @wordpress-plugin | |
* Plugin Name: AMP Jetpack Admin Bar Workaround | |
* Plugin URI: https://gist.github.com/westonruter/d168c290d6c01c107da960d48fa3dad3 | |
* Description: Workaround for <a href="https://github.com/Automattic/jetpack/issues/15353">Automattic/jetpack#15353</a>. | |
* Version: 0.3 | |
* Author: Weston Ruter, Google | |
* Author URI: https://weston.ruter.net/ | |
* License: GNU General Public License v2 (or later) | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* Gist Plugin URI: https://gist.github.com/westonruter/d168c290d6c01c107da960d48fa3dad3 | |
*/ | |
namespace AMP_Jetpack_Admin_Bar_Workaround; | |
// Move up Jetpack AMP support initialization so we can unhook the show_admin_bar filter before other init actions run. | |
add_action( | |
'plugins_loaded', | |
function () { | |
$priority = has_action( 'init', [ 'Jetpack_AMP_Support', 'init' ] ); | |
if ( false === $priority ) { | |
return; | |
} | |
remove_action( 'init', [ 'Jetpack_AMP_Support', 'init' ], $priority ); | |
add_action( | |
'init', | |
function () { | |
\Jetpack_AMP_Support::init(); | |
// Unhook the show_admin_bar filter added in Jetpack_AMP_Support::init(). | |
remove_filter( 'show_admin_bar', [ 'Jetpack_AMP_Support', 'show_admin_bar' ] ); | |
}, | |
-1 | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jetpack v8.4.2 is now available which fixes this issue. Please update and uninstall this workaround plugin.