Skip to main content

benecaster_search_supplemental_episode_ids

Filter Free

Allows add-ons to inject additional episode IDs into the Benecaster’s own search result set before pagination. Benecaster merges them into the query it was already running, so result counts and page numbers stay correct — you do not have to reconcile totals yourself.

This is a Free filter, and one of three that shape search: use benecaster_search_indexable to control which episodes are searchable at all, benecaster_search_query_args to adjust Benecaster’s own query, and this one to add results Benecaster’s own query could never have found. Use it when your add-on stores searchable content outside the Benecaster episode records — for example, an add-on that indexes transcripts, chapter titles, or guest notes in a separate database table can return matching episode IDs here. Callers are responsible for their own visibility and tier gating before returning IDs — only return episode IDs the requesting user should be able to see. Benecaster automatically strips duplicates and IDs of 0 or less.

Parameters

Name Type Default Description
$ids int[] Starts empty; add episode post IDs to include in the result set
$term string Search term
$show_id int Show post ID
$tiers string[] Accessible tier slugs for the requester

Returns: int[]

Examples

Inject episode IDs from transcript search

add_filter( 'benecaster_search_supplemental_episode_ids', function( array $ids, string $term, int $show_id, array $tiers ): array {
    if ( ! benecaster_addon_is_active( 'transcription-service', $show_id ) ) {
        return $ids;
    }
    $transcript_matches = my_search_transcripts( $term, $show_id, $tiers );
    return array_merge( $ids, $transcript_matches );
}, 10, 4 );

Notes

Callers must handle their own visibility and tier gating before returning IDs — only return episode IDs the requesting user should be able to see. Benecaster strips duplicates and IDs of 0 or less from the returned array automatically. See also: benecaster_search_indexable to exclude individual episodes from results after SQL, and benecaster_search_query_args to modify query arguments before the search runs.

Affects

  • GET /benecaster/v1/search REST endpoint

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