Auto-populate Feed Credits from Guest Manager
Inject read-only Podcasting 2.0 credits into an episode’s Feed Credits section without writing to post meta. Benecaster calls benecaster_podcast2_episode_auto_feed_credits after loading meta-stored credits, merges the returned array into the feed render, and discards it — nothing is persisted. Use this filter to bridge a Guest Manager CPT (or any external data store) into the podcast:person feed tags without polluting episode meta.
Code
<?php
add_filter(
'benecaster_podcast2_episode_auto_feed_credits',
function ( array $credits, int $episode_id, int $show_id ): array {
$guest_ids = (array) get_post_meta( $episode_id, '_my_addon_episode_guests', true );
foreach ( $guest_ids as $guest_id ) {
$post = get_post( (int) $guest_id );
if ( ! $post || 'my_addon_guest' !== $post->post_type ) {
continue;
}
$credits[] = [
'role' => 'guest',
'name' => $post->post_title,
'url' => (string) get_post_meta( $post->ID, 'website', true ),
'image' => (string) get_post_meta( $post->ID, 'photo_url', true ),
'source' => 'Guest Manager',
'source_url' => admin_url( 'post.php?post=' . $post->ID . '&action=edit' ),
];
}
return $credits;
},
10,
3
);