Skip to main content

benecaster_episode_page_block_{slug}

benecaster_episode_page_block_{slug}

Filters the rendered HTML of one specific Episode Page block. The filter name is dynamic — {slug} is replaced with the block type slug.

Example filter names: benecaster_episode_page_block_related_episodes, benecaster_episode_page_block_share_buttons, benecaster_episode_page_block_episode_nav

Parameters

Parameter Type Description
$html string Rendered HTML from the block’s renderer callable
$episode_id int Episode post ID
$show_id int Show post ID
$config array Block instance configuration from the show’s _benecaster_episode_page_blocks meta entry

Return: string — return '' to suppress the block entirely.

When It Fires

Fires after the block’s renderer callable returns HTML, once per block per episode page render. The {slug} portion is the block type slug registered via [benecaster_episode_page_block_types](/docs/benecaster_episode_page_block_types/).

Use to wrap a block in a custom container, inject additional markup, or suppress a block for specific shows or episodes without disabling it globally.

Usage

// Wrap the share buttons block in a custom container 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 the listener support block for non-subscriber 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 without removing it from show settings. To suppress the block earlier in the pipeline (before the renderer runs), remove it from the $blocks array via [benecaster_episode_page_blocks](/docs/benecaster_episode_page_blocks/).

For the built-in episode_nav block, this filter fires in addition to [benecaster_episode_nav_output](/docs/benecaster_episode_nav_output/) when rendered via the Episode Page (not the standalone shortcode).