Augment search result excerpts
Override the per-result excerpt returned by the search endpoint. Useful to substitute transcript snippets, chapter titles, or custom-formatted highlights. The Transcription Service add-on uses this pattern to surface the most relevant transcript passage alongside the episode title.
Code
<?php
add_filter(
'benecaster_search_result_excerpt',
function ( string $excerpt, int $episode_id, string $q ): string {
$transcript = get_post_meta( $episode_id, '_my_addon_transcript_snippet', true );
return $transcript ?: $excerpt;
},
10, 3
);