Skip to main content

Override the donation mailing-list opt-in checkbox label

Free Beginner Since v1.0.0

Replaces the default mailing-list opt-in checkbox text on the donation form with a custom label — useful for localisation or to set clearer send-frequency expectations.

The filter receives the default label, the show’s post ID, and the show title so you can include dynamic copy. Add a translators comment when wrapping the string with __() so translation tooling can extract it correctly.

The filter fires in two places: StripeRenderer::donor_enrollment_label() (the visible form label) and ListenerSupportIntentController::get_config() (the label passed to the Stripe payment-intent context for the checkout widget).

Code

<?php
add_filter(
    'benecaster_donor_enrollment_label',
    function ( string $default_label, int $show_id, string $show_title ): string {
        return sprintf(
            /* translators: %s: podcast show title */
            __( 'Yes! Send me updates from %s (~1 email per month, unsubscribe anytime).', 'my-addon' ),
            $show_title
        );
    },
    10,
    3
);

View on GitHub →

Hooks Used