Inject chapter markers from an external source
Pull chapter data from any external service — Podlove, Ausha, or a custom endpoint — and emit a podcast:chapters tag pointing to a JSON chapters file. With the Chapter Markers add-on the data is managed in the episode editor; this recipe shows the filter approach for integrating a service that isn’t natively supported.
Code
<?php
add_filter( 'benecaster_podcast_chapters', function ( array $chapters, int $episode_id ) {
$chapters_url = get_post_meta( $episode_id, '_my_chapters_url', true );
if ( ! $chapters_url ) {
return $chapters;
}
return [
'url' => $chapters_url,
'type' => 'application/json+chapters', // Podlove format (default if omitted)
];
}, 10, 2 );