benecaster_search_supplemental_episode_ids
Allows add-ons to inject additional episode IDs into the core search result set before pagination. Returned IDs are merged into the SQL query via `OR p.ID IN (…)`, preserving `SQL_CALC_FOUND_ROWS` and pagination accuracy.
This is a Free filter. Use it when your add-on stores searchable content outside the core episode table — 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. Core 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' ) ) {
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. Core 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