Register editable fields
register_fieldsRegister custom fields as meta boxes or settings pages, exposing them via REST API. Supports 13 field types for building editable themes without code.
Instructions
Register custom fields that appear as native meta boxes in wp-admin (or as a settings page for site-wide options), and are automatically exposed to the REST API so they can be read and written afterwards. Use this when building a theme so the site stays editable by humans without touching code. Values are stored as ordinary post meta or options, so the data survives even if this tooling is removed. Thirteen field types are supported: text, textarea, wysiwyg, number, email, url, date, select, checkbox, radio, color, image, gallery, repeater.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Group title shown above the meta box. | |
| fields | Yes | The fields in this group, in display order. | |
| context | No | post_meta: a meta box on content. options: a site-wide settings page. | post_meta |
| site_id | No | Which configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids. | |
| position | No | Where the meta box sits in the editor. | normal |
| group_key | Yes | Unique key for this field group, e.g. "homepage_hero". | |
| post_types | No | Which content types get the meta box, e.g. ["page"]. Required for post_meta. | |
| description | No | Help text shown at the top of the group. |