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.

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`, default `true`)
  • Drag-to-reorder selected terms (multi-select only)
  • Optional inline term creation
  • Open-ended mode: omit `taxonomy` to let the editor user pick the taxonomy at edit time

Config options

taxonomystring
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.
restBasestring
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.
multiplebooleandefault: true
Allow more than one term. `false` stores a single-element ids array.
allowCreateTermsbooleandefault: false
Show a "Create new term" form in the picker popover.

Example

json
// 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" }

Gotchas

Heads up
Default is `multiple: true` — opposite of `post-object` (which defaults to single). Pick deliberately.
Heads up
REST base ≠ taxonomy slug for built-ins (`category` → `categories`, `post_tag` → `tags`). The control resolves this automatically; only override `restBase` if you registered a custom one.
Heads up
Switching taxonomy in the open-ended picker clears the selected IDs — they don't translate across taxonomies.