Skip to main content

EpisodeCommentsGate

\Benecaster\Episode\EpisodeCommentsGate

Class Free

Enforces the per-show comments toggle on episode pages at the WordPress filter layer, without calling remove_post_type_support(). When a show’s Enable WordPress comments on episode pages setting is off, closes comments and pings, hides the comment count, and substitutes an empty comments template. This allows each show to be independently gated at request time. Registered as a singleton from Plugin::boot(). Stateless — lookups happen at filter invocation time via ShowMeta::is_comments_enabled().

Methods

Method Visibility Since Description
filter_comments_open( bool $open, int $post_id ): bool Public — Attached to comments_open and pings_open. Returns false when the post is an episode and the parent show has comments disabled. Passes through when $open is already false.
filter_get_comments_number( int|string $count, int $post_id ): int|string Public — Attached to get_comments_number. Returns 0 for gated episodes so comment counts display correctly in templates and meta boxes when the show has comments disabled.
filter_comments_template( string $file ): string Public — Attached to comments_template. For gated episodes, returns the path to templates/episode/comments-off.php. Theme authors can override via {theme}/benecaster/episode/comments-off.php.