Skip to main content

benecaster_subscribe_button_label

Filter Premium

Filters the text of each tier card’s button in benecaster_subscribe on a show using Benecaster’s built-in membership. The default reads Subscribe {billing-period label} — {price}, Subscribe — {price} for a price with no billing-period label, or Join free on a free tier, already translated.

It runs once for every price on a paid tier card, and once for a free tier card. The button changes when the subscriber picks a different billing period, and it changes to the filtered text: Benecaster filters the wording for every price before the page loads and the browser only swaps it in. So a callback must answer for every $price, not only the default one, or the button goes back to the default wording on the first click.

The no-code way to change the middle of the label is the billing-period label in Memberships → Tiers → Prices. Return plain text: it is escaped on output, so markup prints literally.

Not fired on a show using a membership plugin (MemberPress, WooCommerce Subscriptions, Paid Memberships Pro, Restrict Content Pro). Those cards link to the plugin’s own signup page with a plain Subscribe or Join free; change that with translation or benecaster_subscribe_output.

Parameters

Name Type Default Description
$label string — The translated default label for this price.
$price array|null — The price row the label is for (`id`, `label`, `interval_unit`, `interval_count`, `amount_cents`, `currency`, `is_default`), or `null` for a free tier, which has no price.
$show_id int — ID of the show
$tier_slug string — Slug of the tier the card is for, so a callback can tell tiers apart.

Returns: string

Example

// "Join the Supporters — $5.00" instead of "Subscribe Monthly — $5.00".
add_filter( 'benecaster_subscribe_button_label', function ( string $label, ?array $price, int $show_id, string $tier_slug ): string {
    if ( null === $price || 'supporter' !== $tier_slug ) {
        return $label; // Free tiers and every other tier keep the default.
    }
    return sprintf(
        /* translators: %s: formatted price */
        __( 'Join the Supporters — %s', 'my-theme' ),
        '$' . number_format_i18n( $price['amount_cents'] / 100, 2 )
    );
}, 10, 4 );

Affects

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