benecaster_get_referral_link()
benecaster_get_referral_link(): string|null
Returns the podcaster’s own referral URL, ready to share.
Use this rather than building the URL from the referral code. The link format belongs to the licence server and has changed before; a URL you assemble yourself is one deploy away from pointing nowhere. Ask for the link, not the pieces.
See Refer a Friend for how the programme works.
Return Value
Type:
string|null
The customer's full referral URL, or null when there is no link to give — an unlicensed site, or one that has not completed a validation run yet. Whenever benecaster_get_referral_code() returns null, so does this.
Example
add_shortcode( 'my_referral_link', function (): string {
$link = benecaster_get_referral_link();
if ( ! $link ) {
return '';
}
return sprintf( '<a href="%1$s">%1$s</a>', esc_url( $link ) );
} );
Need this built rather than just documented? See our services →