Skip to main content

Make the transcript link a buy-up perk

Free Intermediate

The episode page shows “Read the transcript” to everyone who can access the episode. To keep it for holders of a “Transcripts” buy-up, narrow the link with benecaster_user_has_buyup().

This hides the website link only. The same URL is still in <podcast:transcript> in every feed that carries the episode, so a subscriber’s podcast app still shows the transcript. Use benecaster_user_has_buyup(), never a tier-shaped check: a buy-up’s token_type passed to a tier API fails closed for exactly the buyers.

Code

<?php
add_filter( 'benecaster_show_episode_transcript', function ( bool $show, int $episode_id, ?int $user_id ): bool {
    $my_transcripts_buyup_id = 12; // Memberships → Buy-ups → your "Transcripts" buy-up.
    return $show && $user_id && benecaster_user_has_buyup( $user_id, $my_transcripts_buyup_id, (int) wp_get_post_parent_id( $episode_id ) );
}, 10, 3 );

View on GitHub →

Hooks Used

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