benecaster_episode_itunes_type
Filters the resolved iTunes canonical episode type during RSS feed compilation. The episode’s stored type slug is first mapped to an iTunes canonical value by looking up the show’s episode type definitions in settings. This filter fires after that resolution, giving you the opportunity to override the result before it is written to the feed as `itunes:episodeType`.
The return value must be exactly one of `’full’`, `’trailer’`, or `’bonus’`. Any other return value is treated as invalid — the feed compiler falls back to `’full’` and logs a warning. In most cases the iTunes mapping configured in **Show Settings → Episode Types** is sufficient; this filter is intended for add-ons that manage type behavior programmatically or need to enforce mappings beyond what the admin UI exposes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$itunes_type |
string |
— | Resolved iTunes canonical value: 'full', 'trailer', or 'bonus' |
$custom_slug |
string |
— | Raw slug stored on the episode from _benecaster_episode_type |
$episode_id |
int |
— | ID of the episode |
$show_id |
int |
— | ID of the show |
Returns:
string
Examples
Map intro slug to trailer
add_filter( 'benecaster_episode_itunes_type', function( $itunes_type, $custom_slug, $episode_id, $show_id ) {
// Treat any episode tagged 'intro' as a trailer in the feed.
if ( 'intro' === $custom_slug ) {
return 'trailer';
}
return $itunes_type;
}, 10, 4 );
Force documentary type to full
add_filter( 'benecaster_episode_itunes_type', function (
string $itunes_type,
string $custom_slug,
int $episode_id,
int $show_id
): string {
if ( 'documentary' === $custom_slug ) {
return 'full';
}
return $itunes_type;
}, 10, 4 );
Normalize all types for one show
add_filter( 'benecaster_episode_itunes_type', function (
string $itunes_type,
string $custom_slug,
int $episode_id,
int $show_id
): string {
if ( 123 === $show_id ) {
return 'full';
}
return $itunes_type;
}, 10, 4 );
Notes
The return value must be exactly 'full', 'trailer', or 'bonus'. Any other string causes the feed compiler to fall back to 'full' and log a warning. Auto-numbering uses the stored episode type slug — not the filtered feed value — so overriding the iTunes output here does not affect episode number assignment.