Last active
July 14, 2021 01:44
-
-
Save westonruter/e588bd4ed1778799b19417c838eb5e5e to your computer and use it in GitHub Desktop.
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 LiteSpeed Cache Comment plugin bootstrap. | |
* | |
* @package Disable_LiteSpeed_Cache_Comment | |
* @author Weston Ruter, Google | |
* @license GPL-2.0-or-later | |
* @copyright 2020 Google Inc. | |
* | |
* @wordpress-plugin | |
* Plugin Name: Disable LiteSpeed Cache Comment | |
* Plugin URI: https://gist.github.com/westonruter/e588bd4ed1778799b19417c838eb5e5e | |
* Description: This is needed on sites using the AMP plugin because LiteSpeed Cache by default injects an HTML comment at the end of JSON responses which breaks AMP validation requests. | |
* Version: 0.2 | |
* 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 | |
*/ | |
add_filter( 'litespeed_comment', '__return_false' ); | |
if ( ! defined( 'LSCACHE_ESI_SILENCE' ) ) { | |
define( 'LSCACHE_ESI_SILENCE', true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that this plugin should no longer be necessary once 1.6 is released, as the plugin will proactively strip such comments as of ampproject/amp-wp#4679.