Skip to main content

Customize the Upgrade Prompt for a Specific Show

Free Beginner Since v1.0.0

Use the benecaster_upgrade_prompt_html filter to change copy or add a link to the upgrade prompt shown to logged-in subscribers at the wrong tier. Scope changes to a single show via the $show_id parameter. For full HTML replacement, override global/upgrade-prompt.php from a child theme — $episode_id, $show_id, $required_tier, and $user_tier are available as local variables inside the template file.

Code

<?php
add_filter(
    'benecaster_upgrade_prompt_html',
    function ( string $html, int $episode_id, int $show_id, string $required_tier, string $user_tier ): string {
        if ( $show_id !== 42 ) {
            return $html;
        }
        return sprintf(
            '<p class="my-upgrade">This episode is for %s subscribers. <a href="/subscribe/">Upgrade your plan →</a></p>',
            esc_html( $required_tier )
        );
    },
    10,
    5
);

View on GitHub →

Hooks Used