Guest Manager’s Same guest related episodes, and adjusting them
Guest Manager replaces the by_guest related-episodes query (label Same guest) with its own, through benecaster_related_episodes_query_types, keeping the built-in one, which answers by tag, as its fallback. It applies wherever Same guest can be chosen: [benecaster_related_episodes query="by_guest"], the Related Episodes Episode Page block’s Which episodes to list, and the Blocks & Widgets add-on’s Related by.
- What it lists. Published episodes of the show being asked about (the shortcode’s
show_id, otherwise the episode’s show) that share at least one published guest with the episode, each once, newest first (publish date, then id), at mostcount(0 or less for all), the episode itself left out unlessexclude_currentis false. Drafts and other shows’ episodes never appear. Like every query type, it does not filter for access: the caller drops what the visitor may not see and draws locked episodes locked. - Only where Guest Manager is on for that show. On a show with Guest Manager off, the answer is the by-tag list, exactly as if the add-on were not installed.
- No shared guest falls back to by tag, and when that is empty too, to the latest episodes, as for every query type.
- The replacement is registered only while Guest Manager is on for at least one show. Switched off everywhere,
by_guestis the by-tag list again.
To change only Same guest, register your own query type under a new slug instead (Register a custom related-episodes query strategy).
Code
<?php
// Same guest, but only full episodes: drop trailers and bonus episodes from the list.
add_filter( 'benecaster_related_episodes', static function ( array $episodes, int $episode_id, int $show_id, array $args ): array {
return array_values( array_filter(
$episodes,
static fn( WP_Post $e ): bool => 'full' === get_post_meta( $e->ID, '_benecaster_episode_type', true )
) );
}, 10, 4 );
Hooks Used
Need this built rather than just documented? See our services →