benecaster_register_field_cpt()
benecaster_register_field_cpt( string $cpt_slug, string $label ): void
Opens your own post type up to Benecaster’s field groups, so podcasters can attach custom fields to it the same way they do to episodes.
Call it on benecaster_boot. Earlier than that and Benecaster is not ready to hear it.
What you get for one line. Your post type appears in the “Attached to” dropdown in Benecaster → Fields; podcasters build groups against it without you writing an editor; the REST endpoints that read and write field values accept it; and benecaster_field_groups fires for it, so groups can be injected programmatically exactly as they can for episodes. Benecaster registers benecaster_episode this way — your post type is not a second-class citizen.
Registering the same slug twice replaces the label rather than erroring. That is deliberate: it lets a parent plugin set a default that an add-on can override.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
$cpt_slug |
string |
— | Yes | Your registered post type slug — e.g. 'benecaster_guest'. |
$label |
string |
— | Yes | What a podcaster should see in the "Attached to" dropdown — e.g. 'Guest'. Translate it; this is human-facing. |
Return Value
Type:
void
Nothing.
Example
add_action( 'benecaster_boot', function (): void {
benecaster_register_field_cpt(
'benecaster_guest',
__( 'Guest', 'benecaster-guest-manager' )
);
} );
Need this built rather than just documented? See our services →