Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active May 30, 2021 16:57
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 westonruter/d13eb0175a22f83c41531e7d1a7071fd to your computer and use it in GitHub Desktop.
Save westonruter/d13eb0175a22f83c41531e7d1a7071fd to your computer and use it in GitHub Desktop.
<?php
/**
* Disable amp-onerror Handler plugin bootstrap.
*
* @package Google\AMP_Boilerplate_Error_Handle_Disable
* @author Weston Ruter, Google
* @license GPL-2.0-or-later
* @copyright 2021 Google Inc.
*
* @wordpress-plugin
* Plugin Name: Disable amp-onerror Handler
* Plugin URI: https://gist.github.com/westonruter/d13eb0175a22f83c41531e7d1a7071fd
* Description: Temporary workaround until <a href="https://github.com/ampproject/amphtml/issues/22543">amphtml#22543</a> is fixed.
* Version: 0.1
* 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/d13eb0175a22f83c41531e7d1a7071fd
* Update URI: https://gist.github.com/westonruter/d13eb0175a22f83c41531e7d1a7071fd
*/
namespace Google\AMP_Boilerplate_Error_Handle_Disable;
add_filter(
'amp_optimizer_config',
static function ( $config ) {
$config['transformers'] = array_diff(
$config['transformers'],
[ 'AmpProject\Optimizer\Transformer\AmpBoilerplateErrorHandler' ]
);
return $config;
}
);
@westonruter
Copy link
Author

@mahirbarut
Copy link

Thank you, I hope this bug is fixed soon. It affected many posts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment