Skip to main content

benecaster_episode_page_block_{slug}

Filter Free Since v1.0.0

Pattern-group filter. Fires for each enabled Episode Page block immediately after the block’s renderer callable returns HTML. The filter name is dynamic — `{slug}` is replaced with the block type slug as registered via [benecaster_episode_page_block_types](/hooks/benecaster_episode_page_block_types/). Example filter names: `benecaster_episode_page_block_share_buttons`, `benecaster_episode_page_block_episode_nav`, `benecaster_episode_page_block_related_episodes`.

Built-in block slugs are `context_bar`, `share_buttons`, `episode_nav`, `related_episodes`, `social_links`, `platform_links`, `listener_support`, and `subscribe_cta`. Return an empty string to suppress the block’s output without removing it from show settings. To suppress a block before its renderer runs, remove it from the `$blocks` array via [benecaster_episode_page_blocks](/hooks/benecaster_episode_page_blocks/) instead.

Parameters

Name Type Default Description
$html string Rendered HTML output from the block's renderer callable
$episode_id int ID of the episode being rendered
$show_id int ID of the show
$config array Block config array from the show's _benecaster_episode_page_blocks meta

Returns: string

Examples

Wrap context bar in sticky header

add_filter( 'benecaster_episode_page_block_context_bar', function( $html, $episode_id, $show_id, $config ) {
    return '<div class="sticky-context-bar">' . $html . '</div>';
}, 10, 4 );

Wrap share buttons for one show

add_filter( 'benecaster_episode_page_block_share_buttons', function( string $html, int $episode_id, int $show_id, array $config ): string {
    if ( $show_id !== 42 ) {
        return $html;
    }
    return '<div class="my-custom-share-wrapper">' . $html . '</div>';
}, 10, 4 );

Suppress listener support for public episodes

add_filter( 'benecaster_episode_page_block_listener_support', function( string $html, int $episode_id, int $show_id, array $config ): string {
    if ( get_post_meta( $episode_id, '_benecaster_tier_slug', true ) === 'public' ) {
        return ''; // suppress for free episodes
    }
    return $html;
}, 10, 4 );

Notes

Returning an empty string suppresses the block's HTML output without removing it from show settings. To suppress a block earlier in the pipeline — before its renderer callable runs — remove it from the $blocks array via benecaster_episode_page_blocks. For the built-in episode_nav block, this filter fires in addition to benecaster_episode_nav_output when rendered via the Episode Page.

Affects

  • EpisodePageRenderer block output