Change or remove the affiliate disclosure line on episode pages, in feeds and in emails
When an episode has affiliate links, Outlinks prints a disclosure line above its references on the single episode page, in a feed item’s show notes (<content:encoded>) and in an email’s references block. It is on for every show from the start, and each show can switch it off or set its own wording under Settings → Outlinks → Affiliate disclosure, with no code (see Affiliate Disclosure). This filter is for what the settings can’t do: a rule of your own about when the line shows or what it says. benecaster_outlinks_disclosure_text receives the show’s own wording, or the default “This episode contains affiliate links — we may earn a commission at no extra cost to you.”, and returns the line to print.
It runs only when the line is about to print: Outlinks is 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 or on any of its country rules; an expired link still counts). In a feed or an email, the references counted are the ones in that block, after benecaster_episode_references. The filter receives the same two arguments everywhere.
Code
<?php
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 );
Hooks Used
Need this built rather than just documented? See our services →