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;
	}

 

 

发表回复

后才能评论