Skip to main content

benecaster_episode_description

Filter Free Since v1.0.0

Filters the raw episode description string (the value stored in _benecaster_description_rss post meta) before it is returned or rendered. Fires in both the [benecaster_episode_description] shortcode and the benecaster_get_episode_description() template function.

This filter operates on the raw text string before any HTML is generated. If you want to modify the final rendered HTML output of the shortcode rather than the underlying text, use benecaster_episode_description_output instead.

Parameters

Name Type Default Description
$description string Raw _benecaster_description_rss value
$episode_id int ID of the resolved episode

Returns: string

Examples

Prepend active sponsor message

add_filter( 'benecaster_episode_description', function( $description, $episode_id ) {
    // Prepend a sponsor message to all episode descriptions when a campaign is active.
    $sponsor_note = get_option( 'my_plugin_sponsor_note' );
    if ( $sponsor_note ) {
        return $sponsor_note . "\n\n" . $description;
    }
    return $description;
}, 10, 2 );

Append standard disclaimer

add_filter( 'benecaster_episode_description', function( string $description, int $episode_id ): string {
    // Append a standard disclaimer to all episode descriptions
    return $description . ' ' . get_option( 'my_podcast_disclaimer', '' );
}, 10, 2 );

Notes

This filter fires on the raw string before HTML is generated. To modify the final rendered HTML output of the [benecaster_episode_description] shortcode, use benecaster_episode_description_output instead.

Affects

  • [benecaster_episode_description] shortcode
  • benecaster_get_episode_description() function