Skip to main content

benecaster_buyup_soldout_display

Filter Premium

Filters the sold-out label text shown on a buy-up card when its subscriber cap has been reached. Return an empty string to remove the label entirely — the card will still be non-interactive, but no sold-out text renders.

This filter fires only when the buy-up’s cap has been reached and the current subscriber does not already hold a grant for it. Subscribers with an active grant see their own card state (Active badge) regardless of this filter.

⚠⚠ The returned value is echoed WITHOUT escaping. The contract here is raw HTML — the default is pre-escaped and the call carries an explicit phpcs:ignore saying so. Escape every dynamic part yourself with esc_html(); interpolating an unsanitised value makes this an XSS hole on a logged-in subscriber’s own account page. A non-string return is emitted as PHP casts it, with no warning.

Examples

Custom sold-out message for a specific buy-up

add_filter( 'benecaster_buyup_soldout_display', function (
    string $label,
    string $buyup_slug,
    int    $show_id
): string {
    if ( $buyup_slug === 'transcript-archive' ) {
        return 'Waitlist opening soon';
    }
    return $label;
}, 10, 3 );

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