Skip to main content

Resolve or override an episode’s Explicit flag

Free Beginner

The episode-level Explicit flag is a three-value override — 'inherit', 'yes', or 'no' — never a bool. 'inherit' is the default and falls back to the show’s Explicit setting; 'yes' and 'no' override it for that one episode.

Feed emission resolves the enum against the show default through EpisodeMeta::get_effective_explicit(), so the enum-to-bool mapping lives in exactly one place. Anything else that needs the effective value — a custom feed, a bulk operation, a migration importer, a front-end badge — should call the same resolver rather than reading the post meta and interpreting it independently.

Code

<?php
use Benecaster\Episode\EpisodeMeta;
use Benecaster\Show\ShowMeta;

// Read the effective flag exactly as the RSS compiler does.
$ep_meta     = new EpisodeMeta( $episode_id );
$show_meta   = new ShowMeta( wp_get_post_parent_id( $episode_id ) );
$is_explicit = $ep_meta->get_effective_explicit( $show_meta ); // bool

// Write a per-episode override — never pass a raw bool.
$ep_meta->set_explicit( 'no' );      // force clean regardless of show default
$ep_meta->set_explicit( 'yes' );     // force explicit
$ep_meta->set_explicit( 'inherit' ); // clear the override

View on GitHub →

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