benecaster_episode_embed_audio
Filters the rendered HTML for the embedded audio player on the episode page. Use to swap in a custom player or add attributes.
Return an HTML string. Cast with (string) and output through wp_kses_post().
Fires in two templates with the same two arguments — the single episode player (episode/player.php) and the archive card player (archive/episode-card/player.php) — so a callback cannot tell them apart and changes both. Scope by $episode_id if that matters.
wp_kses_post() strips <iframe> on most installs, so a third-party embed returned here commonly disappears with no error. Only runs when a non-empty embed already exists.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$html |
string |
— | Rendered audio player HTML |
$episode_id |
int |
— | ID of the episode |
$show_id |
int |
— | ID of the show |
Returns:
string
Example
add_filter( 'benecaster_episode_embed_audio', function( $html, $episode_id, $show_id ) {
// Add a preload="none" attribute to defer audio loading until user interaction.
return str_replace( '<audio ', '<audio preload="none" ', $html );
}, 10, 3 );
Affects
- Episode page player