benecaster_get_referral_code()
benecaster_get_referral_code(): ?string
Returns the customer’s referral code from Benecaster’s local license cache. No HTTP call is made — the value is refreshed on each license check.
Pair with benecaster_get_referral_link() to display a ready-to-share URL instead of the raw code.
Return Value
Type:
string|null
The customer's referral code (e.g. "DAVE42"), or null when the license server has not supplied one. Null applies to Launch plan installs, pre-referral-feature server versions, and unactivated sites.
Example
$code = benecaster_get_referral_code();
if ( $code ) {
echo 'Your referral code: ' . esc_html( $code );
}
Need this built rather than just documented? See our services →