Replace the episode player’s video with your own player
[benecaster_player] plays an episode’s video in a plain native <video> element when the episode has no audio URL, or when the shortcode says media="video". To use a different player (Plyr, Video.js, your host’s embed), swap the markup only when the player rendered video. The access check and the locked state have already run by the time this filter sees the HTML.
Keep the .benecaster-player wrapper and both data- attributes. The web play beacon counts one play per element carrying them, so dropping them stops web plays being counted.
The filter never runs for the locked state, so there is no access check to repeat. A visitor shown a preview clip gets the audio player, never this branch.
To sign or rewrite the URL and keep the built-in player, filter benecaster_episode_video_url instead. That also covers the episode page, its archive card and [benecaster_episodes], which this filter does not.
Code
<?php
add_filter( 'benecaster_player_output', function ( string $html, int $episode_id ): string {
if ( ! str_contains( $html, 'benecaster-player--video' ) ) {
return $html; // Audio player — leave it alone.
}
$show_id = (int) wp_get_post_parent_id( $episode_id );
$url = (string) apply_filters(
'benecaster_episode_video_url',
(string) get_post_meta( $episode_id, '_benecaster_video_url', true ),
$episode_id,
$show_id
);
return '<div class="benecaster-player benecaster-player--video" data-episode-id="' . esc_attr( (string) $episode_id ) . '"'
. ' data-show-id="' . esc_attr( (string) $show_id ) . '">'
. '<video class="my-plyr" playsinline controls src="' . esc_url( $url ) . '"></video>'
. '</div>';
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →