benecaster_rss_extra_item_tags
Filters additional XML appended to each episode item in the RSS feed. Use to inject custom namespace elements or non-standard item tags that have no corresponding field in [benecaster_feed_episode_data](/hooks/benecaster_feed_episode_data/). The returned fragment is inserted inside the `item` element, before the closing `/item` tag.
This is a Premium filter requiring an active paid Benecaster license. This filter fires once per episode per feed compilation — keep callbacks lightweight. A Free alternative for post-compilation injection is [benecaster_feed_item_xml](/hooks/benecaster_feed_item_xml/), which receives the full compiled item XML string and allows the same manipulation via string replacement.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$xml |
string |
— | Additional XML to append to the item; default empty string |
$episode_id |
int |
— | ID of the episode |
$show_id |
int |
— | ID of the show |
$tier_slug |
string |
— | Tier slug for this feed compilation pass |
Returns:
string
Examples
Add podcast:season tag
add_filter( 'benecaster_rss_extra_item_tags', function( $xml, $episode_id, $show_id, $tier_slug ) {
// Add a <podcast:season> tag for episodes that belong to a season.
$season = get_post_meta( $episode_id, '_benecaster_season_number', true );
if ( $season ) {
$xml .= '<podcast:season>' . (int) $season . '</podcast:season>';
}
return $xml;
}, 10, 4 );
Add Podlove chapter markers
add_filter( 'benecaster_rss_extra_item_tags', function ( string $xml, int $episode_id, int $show_id, string $tier_slug ): string {
$chapters = get_post_meta( $episode_id, '_chapter_marks', true );
if ( ! is_array( $chapters ) ) {
return $xml;
}
foreach ( $chapters as $chapter ) {
$xml .= sprintf(
'<psc:chapter start="%s" title="%s" />',
esc_attr( $chapter['start'] ),
esc_attr( $chapter['title'] )
);
}
return $xml;
}, 10, 4 );
Inject custom episode type tag
add_filter( 'benecaster_rss_extra_item_tags', function ( string $xml, int $episode_id, int $show_id, string $tier_slug ): string {
$type = get_post_meta( $episode_id, '_custom_episode_type', true );
if ( $type ) {
$xml .= '<myns:type>' . esc_xml( $type ) . '</myns:type>';
}
return $xml;
}, 10, 4 );
Notes
Declare the namespace in the feed root alongside any custom namespace elements — use benecaster_feed_xml to inject the declaration on the rss root element. The Free benecaster_feed_item_xml filter provides the same injection capability via string manipulation without requiring a paid license.