Field keys
A field's key is the name its value is stored under. On a post, a field with the key tagline stores its value as the post's tagline meta. The key is also how templates, dynamic tags and AI assistants refer to the field.
Choosing a key
VX suggests a key from the label. Keep it short, lowercase and descriptive: opening_hours, not field_3 or Opening Hours.
Keys can be up to 64 characters. VX allows other characters too, including capitals, spaces and dots, but they make the key awkward to use in VX Script and code, so stick to letters, numbers and underscores.
Keys that must be unique
Top-level keys must be unique among the fieldsets that share a Location, because those fieldsets store their values in the same place:
- Two fieldsets on Books can't both have a
pricefield. - A fieldset on Books and one on Writers can, because each post type stores its own values.
- All fieldsets on users share one set of keys, since user values are stored per user, not per role.
The key input checks this as you type. When a key is taken, a Taken badge names the field and fieldset that already use it.
Keys inside a container (Group or Repeater) only need to be unique among their siblings. A name inside a "Writer" group and a name inside a "Publisher" group don't clash.
To show the same field in two fieldsets, don't create a second field with the same key. Use a Clone field.
Renaming a key
Changing the key of a field that already has saved values doesn't move those values. They stay under the old key, where the renamed field can't see them, so the field suddenly looks empty.
That's why changing the key opens a dialog asking What happens to existing values:
- Queue a move to the new key
- Queue deletion of the old values
- Leave them under the old key
Moving and deleting are queued in Meta Watch, where you review the plan and run it. Nothing changes in the database until you do.
Deleting a field works the same way: the fieldset saves straight away, and the field's stored values show up in Meta Watch as leftovers you can keep or remove.
Warning
Renaming a key in code (a PHP or JSON definition) or through an AI assistant doesn't open the dialog. Check Meta Watch afterwards, or the values stay behind under the old key.
Technical details for LLMs
- Key: 1–64 characters, any characters (it's the meta key). In VX Script, keys that aren't plain identifiers need quoting or escaping.
- Uniqueness: top-level keys unique among active fieldsets sharing a Location target (all
userLocations are one scope); nested keys unique among siblings in the same container. - Each Content sections layout is its own sibling scope; the keys
_layoutand_layout_labelare reserved inside one. - Rename: a key change is recorded, not applied to stored data. Check with
vx-framework/list-field-migrations, preview withvx-framework/preview-field-migration, apply withvx-framework/run-field-migration, discard withvx-framework/dismiss-field-migration. Warn the user before a rename: until the migration runs, the field reads empty. - Check the keys already in use on a target before adding a field:
vx-framework/get-object-fields.