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 westonruter/c1496d668b2a73a44aa423e6547a59b7 to your computer and use it in GitHub Desktop.
Save westonruter/c1496d668b2a73a44aa423e6547a59b7 to your computer and use it in GitHub Desktop.
<?php
/**
* AMP Reject Validation Errors by Default plugin initialization file.
*
* @package AMP
* @author Weston Ruter, Google
* @link https://gist.github.com/westonruter/c1496d668b2a73a44aa423e6547a59b7
* @license GPL-2.0-or-later
* @copyright 2019 Google Inc.
*
* @wordpress-plugin
* Plugin Name: AMP Reject Validation Errors by Default
* Plugin URI: https://gist.github.com/westonruter/c1496d668b2a73a44aa423e6547a59b7
* Description: Reject sanitization of new AMP validation errors by default. When the AMP plugin is in Transitional mode, this means newly-encountered validation errors will cause a request to an AMP page to redirect to the non-AMP page; on Standard mode sites, the AMP attribute will be removed from the HTML element.
* Version: 0.1.0
* 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/c1496d668b2a73a44aa423e6547a59b7
*/
add_filter( 'amp_validation_error_default_sanitized', '__return_false' );
@westonruter
Copy link
Author

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