benecaster_episode_references_html
Filters the rendered references block that ends each feed item’s <content:encoded> show notes, and that benecaster_get_episode_references_html() returns for an email. Use it to add a line beside the list, such as an affiliate disclosure, where the episode page’s benecaster_before_episode_references and benecaster_after_episode_references actions do not reach. Return '' to render nothing.
It fires only when the list is not empty, after benecaster_episode_references has run, so it cannot add a line to an episode with no references. It does not fire on the episode page, whose markup is the theme-overridable episode/references.php template.
In rss, never vary the result by the current user or request. The feed is compiled once per tier and cached for every listener of that tier.
The block uses only <p>, <ul>, <li> and <a href>, the tags podcast apps agree on: a <p>References</p> line, then each reference group that has entries as a <p> with the group’s name followed by its <ul>, then the ungrouped entries. Keep any line you add to <p> and <a>.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$html |
string |
— | The rendered block |
$references |
array |
— | The list the block was built from, after `benecaster_episode_references` |
$episode_id |
int |
— | ID of the episode |
$show_id |
int |
— | ID of the show |
$context |
string |
— | `rss` or `email` |
Returns:
string
Example
add_filter( 'benecaster_episode_references_html', function ( string $html, array $refs, int $episode_id, int $show_id, string $context ): string {
if ( '' === $html || ! myplugin_has_affiliate_links( $refs, $show_id ) ) {
return $html;
}
return '<p>' . esc_html__( 'This episode contains affiliate links.', 'myplugin' ) . '</p>' . $html;
}, 10, 5 );
Notes
If your line depends on something you store yourself, call do_action( 'benecaster_clear_feed_cache', $show_id ) when that changes, or the feed keeps the old line until its cache expires. See Add a line beside an episode's references in its feed show notes.
Need this built rather than just documented? See our services →