Skip to main content

Override the related-episodes list per-episode

Free Beginner Since v1.0.0

Filter the resolved episode list before the shortcode or Episode Page block renders it. Return a modified array to inject specific episodes, enforce premium-only results, or suppress the widget entirely on specific episodes (return an empty array).

Code

<?php
// On a "coming soon" episode, show no related episodes.
add_filter(
    'benecaster_related_episodes',
    function ( array $episodes, int $episode_id, int $show_id, array $args ): array {
        $status = get_post_meta( $episode_id, '_my_addon_launch_status', true );
        return $status === 'coming_soon' ? [] : $episodes;
    },
    10, 4
);

View on GitHub →

Hooks Used