Skip to main content

Add Podlove chapter markers to RSS

Free Beginner

Benecaster manages chapter markers natively via the episode editor. Use this recipe when you need to append a podcast:chapters tag directly — for example, to pull chapter data from a third-party service or integrate a source that the built-in chapter editor doesn’t cover. The benecaster_rss_extra_item_tags filter appends raw XML to each RSS item, giving you full control over the output.

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
);

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →