benecaster_episode_embed_video
Filters the rendered HTML for the embedded video player on the episode page and on the episode’s archive card.
Return an HTML string. Benecaster casts it with (string) and sanitises it with WordPress’s post allowlist plus <iframe>: an iframe is kept only when it loads from an https:// address, and a <script> or <style> is removed with its contents.
Fires in two templates with the same three arguments: the single episode player (episode/player.php) and the archive card player (archive/episode-card/player.php). A callback cannot tell them apart and changes both; scope by $episode_id if that matters.
This filter only runs when there is already a non-empty embed, and only for a visitor who can access the episode. It is the last thing either player tries: the audio URL, the embedded audio and the video URL all take priority over it. Returning markup from a callback cannot add a player where the episode has none.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$html |
string |
— | Rendered video player HTML |
$episode_id |
int |
— | ID of the episode |
$show_id |
int |
— | ID of the show |
Returns:
string
Example
add_filter( 'benecaster_episode_embed_video', function( $html, $episode_id, $show_id ) {
// Add a playsinline attribute for mobile-friendly inline video playback.
return str_replace( '<video ', '<video playsinline ', $html );
}, 10, 3 );
Affects
- Episode page player
Need this built rather than just documented? See our services →