Field type
taxonomy
Term picker for any taxonomy. Single or multi-select, with optional drag-to-reorder and a "create new term" UI. Omit taxonomy to let the editor pick which taxonomy to use at edit time.
Type: taxonomy · Stored attribute type: object
Stored value
{ taxonomy: string, ids: number[] } — always the canonical shape, whether the schema locks a taxonomy or not. Legacy stored values (bare IDs) are still read correctly.
Supports
- Single or multi-select (
multiple, defaulttrue) - Drag-to-reorder selected terms (multi-select only)
- Optional inline term creation
- Open-ended mode: omit
taxonomyto let the editor user pick the taxonomy at edit time
Config options
| Option | Type | Default | Description |
|---|---|---|---|
taxonomy | string | Optional. Lock the field to one taxonomy slug. When omitted, the editor user picks via a dropdown at edit time. Stored value always carries the chosen taxonomy alongside the IDs. | |
restBase | string | Optional override for the REST base of a taxonomy with a non-standard rest_base. Only needed when register_taxonomy() set a custom rest_base. | |
multiple | boolean | true | Allow more than one term. false stores a single-element ids array. |
allowCreateTerms | boolean | false | Show a "Create new term" form in the picker popover. |
Gotchas
- Default is
multiple: true— opposite ofpost-object(which defaults to single). Pick deliberately. - REST base ≠ taxonomy slug for built-ins (
category→categories,post_tag→tags). The control resolves this automatically; only overriderestBaseif you registered a custom one. - Switching taxonomy in the open-ended picker clears the selected IDs — they don't translate across taxonomies.
Example
// Schema-locked: taxonomy fixed to post_tag.
{ "id": "ctrl_tags",
"type": "taxonomy",
"label": "Tags",
"attributeKey": "tags",
"taxonomy": "post_tag",
"allowCreateTerms": true,
"parentPanelId": "panel" }
// Open-ended: editor picks the taxonomy.
{ "id": "ctrl_classification",
"type": "taxonomy",
"label": "Classification",
"attributeKey": "classification",
"parentPanelId": "panel" }Every field also takes the keys common to all fields.