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 ); | |
} |
Hi Tried to install the zip but Wordpress is giving error
The package could not be installed. No valid plugins were found.
Plugin installation failed.
Return to Plugin Installer
You can instead just download this file and put it into your wp-content/plugins
directory.
Even its Not working ....
It looks like this removed this line:-
<!-- Page generated by LiteSpeed Cache 3.2.1 on 2020-06-10 01:42:36 -->
But not this line:-
<!-- Page optimized by LiteSpeed Cache @2020-06-09 17:42:37 -->
UPDATE: Adding the following will remove the Page Optimized by comment:-
define( 'LSCACHE_ESI_SILENCE', true );
Thanks, I've updated the plugin to define that constant.
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation instructions: https://gist.github.com/westonruter/6110fbc4bef0c4b8c021a112012f7e9c