Last active
March 29, 2021 19:56
-
-
Save schlessera/3c279bac46b3437966e5812901e5f923 to your computer and use it in GitHub Desktop.
AMP Disable Optimizer
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 Disable Optimizer | |
* | |
* @package AMP_Disable_Optimizer | |
* @author Alain Schlesser <[email protected]> | |
* @link https://gist.github.com/schlessera/3c279bac46b3437966e5812901e5f923 | |
* @license MIT | |
* | |
* @wordpress-plugin | |
* Plugin Name: AMP Disable Optimizer | |
* Plugin URI: https://gist.github.com/schlessera/3c279bac46b3437966e5812901e5f923 | |
* Description: Disable the AMP Optimizer via the query arg <code>amp_optimizer=0</code>. | |
* Version: 0.1 | |
* Author: Alain Schlesser <[email protected]> | |
* Author URI: https://alainschlesser.com/ | |
* License: MIT | |
* Gist Plugin URI: https://gist.github.com/schlessera/3c279bac46b3437966e5812901e5f923 | |
*/ | |
if ( isset( $_GET['amp_optimizer'] ) && false === rest_sanitize_boolean( $_GET['amp_optimizer'] ) ) { | |
add_filter( 'amp_enable_optimizer', '__return_false', 100 ); | |
} else { | |
add_filter( 'amp_enable_optimizer', '__return_true', 100 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment