Skip to main content

Field Groups REST API

A single endpoint for reading registered CPTs in Benecaster’s custom fields system. Used internally by the Field Group editor to populate the “Attached CPT” dropdown.


GET /benecaster/v1/field-groups/registered-cpts

Returns all CPTs that have been registered with Benecaster’s custom fields system via benecaster_register_field_cpt().

Auth: manage_options + X-WP-Nonce

Response:

{
  "items": [
    { "slug": "benecaster_episode", "label": "Episode" },
    { "slug": "my_addon_transcript", "label": "Transcript" },
    { "slug": "my_addon_chapter", "label": "Chapter" }
  ]
}

Response fields:

Field Description
slug The WordPress post type slug, as passed to benecaster_register_field_cpt()
label Human-readable display name, derived from the post type’s registered label

Notes:

  • benecaster_episode is always present — episode is the core CPT registered by the plugin itself.
  • Add-ons that call benecaster_register_field_cpt() in their boot sequence appear here automatically. The endpoint reads from FieldRegistry’s internal registry at call time, so add-ons must be active for their CPTs to appear.
  • The Field Group editor uses this endpoint to populate the “Attached CPT” picker when creating or editing a field group. If an add-on registers a CPT but doesn’t appear in this list, the add-on is either not active or is calling benecaster_register_field_cpt() too late in the WordPress boot sequence.
  • The benecaster_field_groups filter fires in the field group rendering layer, not in this endpoint — this endpoint returns registration data only.

See also: benecaster_register_field_cpt() (the function that registers a CPT) and FieldRegistry (the class that manages the registration).

See Also