How to remove WP Rocket plugin comment code? Remove WPRocket foreground comments

How to remove foreground comments from WP Rocket plugin?

WP-Rocket is a very useful caching and management plugin for WordPress that can greatly improve website loading speed.

However, its developers will leave comment ads in your website code whether you pay or not.

As shown below ▼

How to remove WP Rocket plugin comment code? Remove WPRocket foreground comments

Next, share how to delete the WP Rocket plugin comment code and remove ads hidden in the page?

How to remove the front-end comment code of the WP Rocket plugin website

WP Rocket has been added since version 2.0 get_Rocket_footprint() method.Add a tail image at the end of the page source code, which is the following paragraph.Edit the WordPress files in the following paths to remove them.

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

The version 3.9.x tested in this article starts at about line 436.you can see get_Rocket_footprint() The method is roughly as follows:

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; /*不返回注释 去除广告注释*/
}
  • Just comment out the return value return at the end and make it not return a value

Since WordPress plugins are usually in a constant update cycle, the exact location may change.

In this case:

  1. You can download plugin files locally.
  2. in UseNotepad++ code editoror other editing tools to find plugin files globally;
  3. search keyword"this website"or"performance optimized. "
  4. After you find it, comment it out or delete it.

Comment

Your email address will not be published. Required fields are marked with * .

Scroll to Top