benecaster_explicit_badge_mode
Overrides the resolved explicit mode for one episode before the badge is rendered. This is the first of the three badge filters to run, and the value it returns is what benecaster_explicit_badge_label and benecaster_explicit_badge_html then see.
The incoming mode has already been resolved: the episode’s own override wins, and an episode set to inherit falls back to the show’s setting. Filter here when you want to change that outcome programmatically without writing to the episode — a special series that should carry the badge regardless, a syndication context where everything renders clean, a rule driven by category rather than by the stored value.
Change the mode, not the wording. If what you want is different text, use the label filter. The mode is the semantic value and it drives the aria-label and the class modifiers as well as the visible text.
This is the show-side enum, not the episode-side one. It is 'clean', 'yes', or 'explicit' — the three values the show’s Explicit selector offers. It is not the episode override enum ('inherit' / 'yes' / 'no'), because by the time the badge renders, inheritance has already been resolved and there is nothing left to inherit. A return value outside the three legal modes falls back to 'clean', which renders nothing — failing toward silence rather than toward a wrong label on somebody’s episode.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$mode |
string |
— | Resolved mode — `'clean'`, `'yes'`, or `'explicit'`. Both `'yes'` and `'explicit'` mean explicit; the difference is only the podcaster's chosen wording. |
$episode_id |
int |
— | WordPress post ID of the episode being rendered. |
$show_id |
int |
— | WordPress post ID of the episode's show. |
Returns:
string
Examples
Force the badge on a single episode
add_filter( 'benecaster_explicit_badge_mode', function ( string $mode, int $episode_id, int $show_id ): string {
return 12345 === $episode_id ? 'yes' : $mode;
}, 10, 3 );
Suppress every badge on one show
add_filter( 'benecaster_explicit_badge_mode', function ( string $mode, int $episode_id, int $show_id ): string {
// Show 88 is syndicated to a partner that renders its own rating chip.
return 88 === $show_id ? 'clean' : $mode;
}, 10, 3 );
Need this built rather than just documented? See our services →