GCBGutenberg
Control Blocks
Buy

Structured fields

Fields and post types in JSON files

Field files in the theme

Reference, generated from the plugin source

Autoloader for structured-field JSON schemas.

Mirrors the block.fields.json convention for the four structured-field registrars. On init (priority 1, before themes typically register theirs at priority 10), globs the active theme for:

Text
post-fields/{post-type}.fields.json     → gcblite_register_post_fields()
taxonomy-fields/{taxonomy}.fields.json  → gcblite_register_taxonomy_fields()
options-fields/{slug}.fields.json       → gcblite_register_options_fields()
user-fields.fields.json                 → gcblite_register_user_fields()

Each file has the shape { "controls": [...] } — same schema as block.fields.json. PHP gcblite_register_*_fields() helpers continue to work alongside JSON files; both paths converge on the same registrar internals.

Post types from config

Reference, generated from the plugin source

Config-driven custom post type registration.

GCB already attaches structured fields to a post type (PostFields\Registrar), but registering the post type itself was theme code (register_post_type() in functions.php). This closes that gap: a CPT is described as JSON under the active theme's gcb-post-types/ directory (one file per type, mirroring how blocks live under blocks/), and GCB registers it on init — plus any taxonomy and structured fields declared alongside.

Config shape (gcb-post-types/person.json):

Text
{
  "post_type": "person",
  "args": { "label": "People", "public": true, "menu_icon": "dashicons-groups",
            "supports": ["title", "thumbnail"], "has_archive": true },
  "taxonomies": [
    { "taxonomy": "department", "args": { "label": "Departments", "hierarchical": true } }
  ],
  "fields": { "controls": [ … same shape as block.fields.json … ] }
}

Built from GCB Lite 0.4.0 (ce232d4). Source: includes/StructuredFields/Autoloader.php, includes/PostTypes/PostTypeRegistrar.php.

Copyright © 2026 Runchain. WordPress is a trademark of the WordPress Foundation.