benecaster_apply_default_credit()
benecaster_apply_default_credit( int $episode_id ): bool
Public helper that applies the show’s default credit template to an episode. Resolves the parent show from $episode_id, runs the show’s credit definition list through the benecaster_credit_options filter, picks the entry flagged is_default: true, and stamps it onto the episode.
On success it fires benecaster_credit_before_stamp before shortcode resolution and benecaster_credit_applied after persisting the result.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
episode_id |
int |
— | Yes | The episode (post) ID to stamp with the show's default credit template. |
Return Value
Type:
bool
true when the default credit was successfully stamped onto the episode. false when the episode ID is invalid, the post type is not the Benecaster episode CPT, the episode has no parent show, no credit entry in the (filtered) list has is_default: true, or the stamp operation throws for any other reason.
Example
$ok = benecaster_apply_default_credit( $episode_id );
if ( ! $ok ) {
// The stamp did not complete — log or handle as appropriate
}
Hooks Fired
Notes
This is the supported, add-on-safe entry point for stamping a show's default credit. It handles show resolution, the benecaster_credit_options filter, and default selection, so add-ons never need to touch the internal stamping mechanism directly.
To stamp a specific non-default credit, use the ShowCreditsController PUT endpoint to promote a credit to default first, or use the EpisodeCreditsController REST endpoint to stamp by credit ID directly.
Need this built rather than just documented? See our services →