删除WP-Rocket缓存插件在前台页尾添加的注释代码

WP-Rocket是一款非常好用的缓存生成和管理插件,可以大大提高网站访问速度。但是,无论你是否付费,其开发人员都会在你的网站代码里留下注释广告。

注释代码如下

<!--
Performance optimized by Redis Object Cache. Learn more: https://wprediscache.com

Retrieved 4937 objects (745 KB) from Redis using PhpRedis (v5.3.4).
-->

如何删除WP-Rocket缓存插件在前台页尾添加的注释代码,解决方法,编辑以下路径里面的class-cache.php文件

路径:

/wp-content/plugins/wp-Rocket/inc/classes/Buffer/class-cache.php

大约在444行左右会看见这个 get_Rocket_footprint() 文件如下代码

	private function get_rocket_footprint( $time = '' ) {
		$footprint = defined( 'WP_ROCKET_WHITE_LABEL_FOOTPRINT' ) ?
						"\n" . '<!-- Cached for great performance' :
						"\n" . '<!-- This website is like a Rocket, isn\'t it? Performance optimized by ' . WP_ROCKET_PLUGIN_NAME . '. Learn more: https://wp-rocket.me';
		if ( ! empty( $time ) ) {
			$footprint .= ' - Debug: cached@' . $time;
		}
		$footprint .= ' -->';
		return $footprint;
	}

注释掉return $footprint;即可

完成结果

	private function get_rocket_footprint( $time = '' ) {
		$footprint = defined( 'WP_ROCKET_WHITE_LABEL_FOOTPRINT' ) ?
						"\n" . '<!-- Cached for great performance' :
						"\n" . '<!-- This website is like a Rocket, isn\'t it? Performance optimized by ' . WP_ROCKET_PLUGIN_NAME . '. Learn more: https://wp-rocket.me';
		if ( ! empty( $time ) ) {
			$footprint .= ' - Debug: cached@' . $time;
		}
		$footprint .= ' -->';
//		return $footprint;
	}

 

 

声明:本站所有软件资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
有新私信 私信列表
搜索