Skip to main content

benecaster_ai_search_panel_results

Filter Premium ai-search

Filters one search’s results in the AI Search production panel, the side panel beside every Benecaster admin screen where a podcaster searches their own back catalog. Each result is { id, show_id, show_title, title, episode_number, season_number, date, excerpt, excerpt_source }, best first across the shows searched, at most 20.

Admin only, so it may add anything the podcaster may see. Every published episode of the searched shows can be returned, members-only ones included, and excerpt can be a line of the transcript (excerpt_source transcript).

Parameters

Name Type Default Description
$results array — List of `{ id, show_id, show_title, title, episode_number, season_number, date, excerpt, excerpt_source }`
$query string — The search, trimmed
$show_ids int[] — The shows searched, each with AI Search switched on

Returns: array

Example

// Leave out episodes older than two years.
add_filter( 'benecaster_ai_search_panel_results', function ( array $results, string $query, array $show_ids ): array {
    $cutoff = strtotime( '-2 years' );
    return array_values( array_filter( $results, fn( array $r ): bool => get_post_time( 'U', true, $r['id'] ) >= $cutoff ) );
}, 10, 3 );

Notes

Affects

  • GET benecaster-ai-search/v1/panel/search

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