We have always received requests to remove or modify our debug footer comment. Now that we can no longer offer white label, should we provide some way to modify it?
HS tags: footprint, white label
Adding a filter to modify it makes sense to me. I don't think we should allow removal though, it would make the support job more difficult.
Agree with Remy we shouldn't have a total removal.
I suggest to use a constant in wp-config.php, for multisite it will be easer to avoid to add it in all functions.php theme or ask to our users to create a new file with the filter and put it into a mu-plugin
Can we do both, constant first, filter later on?
A filter would cater to use cases where a custom plugin would be more convenient, while I agree with @GeekPress that for multisite a constant could be super helpful.
We could progressively define the constant in the main plugin file, and filter it in get_rocket_footprint(). Also, should we make the debug part of the string _not_ customisable?
Hereās a modest proposal:
// wp-rocket.php:
if ( ! defined( 'WP_ROCKET_FOOTPRINT_STRING' ) ) {
define( 'WP_ROCKET_FOOTPRINT_STRING', 'This website is like a rocket, isnāt it? Performance optimized by WP Rocket. Learn more: https://wp-rocket.me' );
}
//functions/files.php:
function get_rocket_footprint( $debug = true ) {
// Filter constant value.
$footprint_string = apply_filters( 'rocket_footprint_string', WP_ROCKET_FOOTPRINT_STRING );
// Avoid accidentally nested comments.
$footprint_string = str_replace( [ '<!--', '-->' ], '', $footprint_string );
// Add debug fragment (not customisable).
if ( $debug ) {
$footprint_string .= ' - cached@' . time();
}
$footprint = "\n" . '<!-- ';
$footprint .= esc_attr( $footprint_string );
$footprint .= ' -->';
return $footprint;
}
I'm not a fan to allow people to make their own message and totally replace our own.
If the issue is just to have "WP Rocket" in the footer, the old "Cached page for great performance" is enough.
@GeekPress _(If Iām saying something youāve already considered, ignore me.)_ š
The approach above would still output the debug string, even if an empty string was passed to the constant or filter. So with dev tools open, we should usually see this:
<!-- - cached@{timestamp} -->
If that part should be more unique, we could (for example) change it to:
<!-- āØcached@{timestamp} ⨠-->
⦠or whatever works best. In any case, there would always be a footprint, just no default text from our end, except the debug string.
The cases that led @webtrainingwheels to post this issue/proposal were customers not being fans of having random copy printed into their HTML sourceāwhich I can understand, to be honest.
The string as it is now is straightforward advertisingāit contains clear branding, and provocative wording. Nothing wrong with that at all, but a professional possibly would want to remove uninvited third-party branding from the HTML source of a client site, just as they would remove the theme author link from a theme footer.
We could ask our customers _why_ they want to customise the footprint, but for sake of discussion letās pretend for a moment we already knew, and the reason was: itās an ad.
If that was the case, one way to remove the problem without risking the footprint to be removed entirely could be to make it a feature instead of just an ad.
When the WP Rocket product team discusses a new feature for WP Rocket, they always put the user first, donāt they? What do they need, what do they want, how is this useful etc.?
Thatās why this discussion got me thinking about the $debug (cached@) part which currently gets written into the footprint when the document is saved to cache, so we only see it when it gets served _from_ cache.
I believe we could triple-win here if we split the footprint into 2 clear parts more deliberately:
<!-- {brand-related, customisable } {technical, not customisable} -->
The ātechnicalā bit of cached@ provides contextual info about the nature of the HTML document:
However, no equivalent is displayed when a document gets served from the database (āfirst viewā).
In the spirit of turning this whole thing into a (more) useful feature, why donāt we engineer the footprint to also reflect the case where the page is not (yet) served from cache?
That way, weād accommodate professionals whoād like the string to mention their own brand (or no brand at all) while adding value for everyone (including our support crew) by providing additional info about the context of the HTML document (served from cache, or not).
In the example below I extended the if ( $debug ) condition so that a different ātechnicalā part gets displayed when $debug is not true. (Discrete ASCII art for fun and utmost subtle branding, totally optional of course.)
// wp-rocket.php:
if ( ! defined( 'WP_ROCKET_FOOTPRINT_STRING' ) ) {
define( 'WP_ROCKET_FOOTPRINT_STRING', 'This website is like a rocket, isnāt it? Performance optimized by WP Rocket. Learn more: https://wp-rocket.me' );
}
//functions/files.php:
function get_rocket_footprint( $debug = true ) {
// Filter constant value (and make sure itās interpreted as a string).
$footprint_string = (string) apply_filters( 'rocket_footprint_string', WP_ROCKET_FOOTPRINT_STRING );
// Note: At this point, $footprint_string could contain an empty string.
// Avoid accidentally nested comments.
$footprint_string = str_replace( [ '<!--', '-->' ], '', $footprint_string );
// Add debug fragment (not customisable).
if ( $debug ) {
// Serving document from cache.
$footprint_string .= ' dļ¾ā
cached@' . time() . ' ā
ļ¾ļ½„ ';
} else {
// Serving document from database. (āfirst viewā)
$footprint_string .= ' dļ¾ā
served from database, refresh to load cached document ā
ļ¾ļ½„ ';
}
$footprint = "\n" . '<!-- ';
$footprint .= esc_attr( $footprint_string );
$footprint .= ' -->';
return $footprint;
}
Obviously, this example is still simplified. It doesnāt yet consider cases where we disable page caching, like on some hosting environments.
Iād see basically 2 ways to treat those cases: a) choose a more generic wording for the āserved from database ā¦ā part, or b) get even more serious about this whole thing and add contextual info for all the special cases we have (WP Engine, Kinsta, et al).
@GeekPress Iām aware this probably looks like total overhead, and we all know I can go disproportionally nuts about little details. š
However, I do believe in _meaningful_ details.
If weāre going to print an HTML comment into customer pages, I believe we owe them not only control over its wording, but also character. It should be the darn best caching footprint in the universe, and by ābestā I donāt necessarily mean āfunnyā (though entertainment can certainly be a nice side effect), but meaningful.
@glueckpress I understand your point of view about the debug infos.
Unfortunately, I still don't understand why we want to have a custom string for the footprint. We never had complaints about the fact users can't put their own footprint. The complaints was about having a brand ads into it.
To have a first simple/quick step on this subject, could we just re-introduce define ('WP_RWL', true); (or an other name if you don't like it) in the wp-config.php file?
If so, it will replace the branded footprint by Cached page for great performance.
And then, having a dedicated brainstorming about the debug part.
@GeekPress When you are paying for something you should be able to remove their complete branding, and yes you must keep their name in your product if the service or plugin is free.
Simply edit
/**
Hi there,
why is this labeled as "minor"?
I wait for an solution to get rid of "Performance optimized by WP Rocket. Learn more: https://wp-rocket.me" since the whitelable was stopped by you. Inside your product there is a way to kill all comments inside HMTM&CSS and this is a really good solution not only for pagespeed also for disabling 3thparty production-links to show up inside the code.
I have a running 2 years sub, be your customer for 4 years now and brought around 20 customers to you, but when there will be no solution for it in the next view months I'll delete everything and choose one of the competitors. Sorry to be so harsh but its not OK for an paying service to show automatically a backlink. Make it optional and everything is fine.
cheers
@TenserD use define('WP_ROCKET_WHITE_LABEL_FOOTPRINT', true); in your wp-config.php and the backlink + mention of WP Rocket will be removed.
Most helpful comment
@glueckpress I understand your point of view about the debug infos.
Unfortunately, I still don't understand why we want to have a custom string for the footprint. We never had complaints about the fact users can't put their own footprint. The complaints was about having a brand ads into it.
To have a first simple/quick step on this subject, could we just re-introduce
define ('WP_RWL', true);(or an other name if you don't like it) in the wp-config.php file?If so, it will replace the branded footprint by
Cached page for great performance.And then, having a dedicated brainstorming about the debug part.