Skip to main content

benecaster_player_output

Filter Free Since v1.0.0

Filters the full rendered HTML output of the [benecaster_player] shortcode. Fires after access control has been applied — if the current user cannot access the episode, $html is already the locked-state message rather than the player. This filter always fires regardless of access state.

Use to wrap the output in a custom container, inject additional markup around the player, or replace the output entirely. Return an empty string to suppress the shortcode completely.

Parameters

Name Type Default Description
$html string Full rendered shortcode output
$episode_id int ID of the episode
$atts array Resolved shortcode attributes

Returns: string

Examples

Wrap player in branded container

add_filter( 'benecaster_player_output', function ( $html, $episode_id, $atts ) {
    if ( $html ) {
        $html = '<div class="my-player-wrap" data-episode="' . (int) $episode_id . '">' . $html . '</div>';
    }
    return $html;
}, 10, 3 );

Wrap in custom container div

add_filter( 'benecaster_player_output', function ( string $html, int $episode_id, array $atts ): string {
    return '<div class="my-player-wrapper">' . $html . '</div>';
}, 10, 3 );

Notes

This filter fires for both the accessible (player) state and the locked-state message. Check the content of $html if your callback should only act when the player is accessible.

Affects

  • [benecaster_player] shortcode