Skip to main content

Skip importing trailer episodes during feed sync

Free Beginner Since v1.0.0

Feed sync imports every episode it finds by default. Return false from benecaster_feed_sync_should_import to skip specific episodes — trailers, bonus content, or episodes from dates before the migration cutoff — without modifying the source feed or running a post-import cleanup pass.

Code

<?php
add_filter(
    'benecaster_feed_sync_should_import',
    function ( bool $should_import, array $item, int $show_id ): bool {
        if ( ! $should_import ) {
            return false;
        }
        $type = strtolower( (string) ( $item['itunes_episode_type'] ?? 'full' ) );
        if ( 'trailer' === $type ) {
            return false;
        }
        return true;
    },
    10,
    3
);

View on GitHub →

Hooks Used