Skip to main content
Glama

Register editable fields

register_fields

Register custom fields as native WordPress meta boxes or settings pages, exposed to the REST API for reading and writing. Keep sites editable by humans without touching 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. Fourteen field types are supported: text, textarea, wysiwyg, number, email, url, date, select, checkbox, radio, color, image, gallery, repeater.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesGroup title shown above the meta box.
fieldsYesThe fields in this group, in display order.
contextNopost_meta: a meta box on content. options: a site-wide settings page.post_meta
site_idNoWhich 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.
positionNoWhere the meta box sits in the editor.normal
group_keyYesUnique key for this field group, e.g. "homepage_hero".
post_typesNoWhich content types get the meta box, e.g. ["page"]. Required for post_meta.
descriptionNoHelp text shown at the top of the group.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / fields / items / additionalProperties
      Removed value: -false
    • removedInput schema / properties / fields / items / properties / choices / items / additionalProperties
      Removed value: -false
    • addedInput schema / properties / fields / items / properties / choices / items / properties / label / description
      Added value: +"Label shown to the editor."
    • addedInput schema / properties / fields / items / properties / choices / items / properties / value / description
      Added value: +"Stored value."
    • addedInput schema / properties / fields / items / properties / default / description
      Added value: +"Value used when nothing has been saved yet."
    • addedInput schema / properties / fields / items / properties / placeholder / description
      Added value: +"Placeholder text shown in an empty input."
    • addedInput schema / properties / fields / items / properties / required / description
      Added value: +"Whether the editor must fill this field in."
    • addedInput schema / properties / fields / items / properties / sub_fields / items
      Added value: +{}
  2. First observedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses persistence behavior ('stored as ordinary post meta or options'), data survival ('survives even if this tooling is removed'), and API exposure. Annotations already indicate a write operation, but this adds useful storage and durability context. It does not clarify behavior if group_key is registered again, which idempotentHint=false hints at.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences, with the primary purpose front-loaded in the first sentence. The field-type enumeration is somewhat redundant with the schema but not overly wasteful. Overall it is concise and scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers purpose, typical use case, storage behavior, and field-type variety. With the schema fully documenting all parameters and no output schema required, this is largely complete. It omits what happens on repeated registration, but that is a minor gap given the annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the parameter baseline is 3. The description lists the fourteen field types, but this mostly repeats the enum in the schema rather than adding new meaning. It provides no extra guidance on parameter relationships or edge cases.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Register') and resource ('custom fields') and clarifies where they appear ('native meta boxes in wp-admin' or 'settings page for site-wide options'). It also mentions REST API exposure, which distinguishes it from management siblings like list_field_groups and delete_field_group.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a clear context: 'Use this when building a theme so the site stays editable by humans without touching code.' It does not mention explicit alternatives or exclusions (e.g., when to use set_option instead), so it falls short of full routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools