benecaster_episode_video_url
Filters the video file URL wherever Benecaster plays a video on your website: the episode page, the archive episode card, [benecaster_player] (and so [benecaster_latest_episode]‘s player section) and each [benecaster_episodes] item. Never runs in a feed and does not affect the RSS enclosure URL.
Return a URL string. Cast with (string) and output through esc_url() into the <video src> attribute, so a disallowed protocol becomes an empty attribute rather than an error.
Only runs when a video is about to play. That means the episode has a direct video URL, the viewer can access the episode, and nothing earlier won: the episode page, the archive card and the list play the audio URL first when there is one, and [benecaster_player] plays it unless media="video". A callback cannot introduce a player where none was resolved. Returning '' emits a <video> element with an empty src, which browsers render as a broken player rather than hiding it.
A visitor shown a preview clip never reaches this filter. The clip is swapped in on the audio URL, so that visitor gets the audio player.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$url |
string |
— | Video file URL |
$episode_id |
int |
— | ID of the episode |
$show_id |
int |
— | ID of the show |
Returns:
string
Example
add_filter( 'benecaster_episode_video_url', function( $url, $episode_id, $show_id ) {
// Redirect the video URL to a Bunny CDN pull zone.
return str_replace( 'https://origin.example.com/', 'https://pullzone.b-cdn.net/', $url );
}, 10, 3 );
Affects
- Episode page player
- Archive episode card player
- benecaster_player shortcode
- benecaster_episodes shortcode
Need this built rather than just documented? See our services →