Skip to main content

benecaster_outlinks_disclosure_text

Filter Premium outlinks

Filters the affiliate disclosure line Outlinks prints above an episode’s references: on its single episode page, in a feed item’s show notes (<content:encoded>) and in an email’s references block. $text is the show’s own wording from Show Settings → Outlinks → Affiliate disclosure, or the default: “This episode contains affiliate links — we may earn a commission at no extra cost to you.”

It runs only when the line is about to print: Outlinks is switched on for the show, the show’s disclosure is on, and at least one of the episode’s references has a tracked link with an affiliate URL (on the link itself or on one of its country rules; an expired link still counts). So it cannot add a disclosure to an episode with no affiliate links. In a feed or an email, the references counted are the ones in that block, after benecaster_episode_references.

On the episode page the line is printed from Benecaster’s benecaster_before_episode_references action. A theme that overrides the episode references template and leaves that action out gets no line and no filter call there; feeds and emails are unaffected. In feeds and emails the line is added through Benecaster’s benecaster_episode_references_html filter, as a plain paragraph with no class. The filter receives the same two arguments everywhere.

In a feed, the references block is built once per tier and cached for every listener, so the text you return must not depend on the current user or request. Saving a show’s disclosure settings on its Outlinks tab clears that show’s feeds.

Parameters

Name Type Default Description
$text string — The show's disclosure text, or the default
$show_id int — ID of the episode's show

Returns: string

Example

add_filter( 'benecaster_outlinks_disclosure_text', function ( string $text, int $show_id ): string {
    if ( 12 === $show_id ) {
        return ''; // This show discloses in its own episode template.
    }
    return $text . ' ' . __( 'Thank you for supporting the show.', 'my-theme' );
}, 10, 2 );

Notes

Plain text only: the return is trimmed and escaped, so HTML shows as text. Return '', or anything that is not a string, to print nothing. To change the stored wording rather than the line at render time, use the show's Affiliate disclosure setting or its REST route. Walkthrough: Change or remove the affiliate disclosure line on episode pages, in feeds and in emails.

Need this built rather than just documented? See our services →