Skip to main content

benecaster_tier_name_output

Filter Premium

Filters the text output of benecaster_tier_name before it is returned to the page. Returns empty string if the slug is not found.

$output arrives already HTML-escaped. Do not escape it again, or an ampersand in a tier name shows as &.

Return the complete HTML string for the shortcode. Cast with (string). The return value is printed as it is, so a callback may add its own markup, and any other dynamic text it adds must be escaped by the callback.

Returning '' makes the shortcode render nothing at all, which is the supported way to suppress it conditionally. The $atts parameter is the shortcode’s resolved attributes, so a callback can scope itself to one usage rather than every instance on the site.

Parameters

Name Type Default Description
$output string — Tier display name, already HTML-escaped; empty string if not found
$show_id int — ID of the show the tier was looked up on. The tier slug is `$atts['tier']`.
$atts array — Resolved shortcode attributes

Returns: string

Example

add_filter( 'benecaster_tier_name_output', function( $output, $show_id, $atts ) {
    // Map internal tier slugs to marketing-friendly display names.
    $names = [
        'starter' => 'Listener',
        'premium' => 'Superfan',
    ];
    return $names[ $atts['tier'] ?? '' ] ?? $output;
}, 10, 3 );

Need this built rather than just documented? See our services →