Add Podlove chapter markers to RSS
Shows the manual filter approach for adding podcast:chapters to RSS items by appending the tag directly via benecaster_rss_extra_item_tags. With the Chapter Markers add-on the data is managed via UI and auto-populated — use this recipe as a reference for the underlying mechanism, or to pull chapter data from a third-party service that is not the Chapter Markers add-on.
Code
<?php
add_filter(
'benecaster_rss_extra_item_tags',
function ( array $tags, int $episode_id, int $show_id ): array {
$chapters_url = (string) get_post_meta( $episode_id, '_my_chapters_json_url', true );
if ( '' === $chapters_url ) {
return $tags;
}
$tags['podcast:chapters'] = [
'value' => '',
'attributes' => [
'url' => esc_url_raw( $chapters_url ),
'type' => 'application/json+chapters',
],
];
return $tags;
},
10,
3
);