Skip to main content

benecaster_current_tier_output

Filter Premium

Filters the text output of the [benecaster_current_tier] shortcode. The shortcode renders the subscriber’s current tier display name, or an empty string for non-subscribers. $tier_slug and $user are null for guests or visitors with no token for the show — return $output unchanged for those cases. $output arrives already HTML-escaped (the fallback text included), so do not escape it again. The filter output is returned verbatim: a callback may add its own markup, and must escape any other dynamic text it adds.

Parameters

Name Type Default Description
$output string — Current rendered output, already HTML-escaped (tier display name, fallback value, or empty string)
$show_id int — ID of the show being resolved
$tier_slug string|null — Raw tier slug from the token; null for guests or visitors with no active tier mapping
$user \WP_User|null — WordPress user object of the logged-in visitor; null for guests
$atts array — Resolved shortcode attributes (show_id, format, fallback)

Returns: string

Example

add_filter( 'benecaster_current_tier_output', function( $output, $show_id, $tier_slug, $user, $atts ) {
    // Append a badge icon next to the tier name for premium subscribers.
    if ( 'premium' === $tier_slug ) {
        $output .= ' ⭐';
    }
    return $output;
}, 10, 5 );

Affects

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