Field type
icon
Visual picker over the WP 7.0+ icon registry. Authors pick from a searchable grid; storage is just the icon name. The server resolves to SVG at render time via WP_Icons_Registry.
Type: icon · Stored attribute type: object
Stored value
{ source: "wp", name: string }
Supports
- Searchable grid of icons from the WP icon registry
- Namespace filter — only show icons whose name starts with
${namespace}/ - Explicit allow-list via
filterfor hand-curated subsets - Backwards-compat read of v1 dashicon values:
{ source: "dashicon", icon }still renders, but the picker only writes the new{ source: "wp", name }shape.
Config options
| Option | Type | Default | Description |
|---|---|---|---|
namespace | string | Restrict the picker to icons whose name starts with ${namespace}/. Forward-compat with WP 7.1's register_block_icon API. | |
filter | string[] | Explicit allow-list of full icon names. Takes precedence over namespace. Use for hand-curated subsets per block. |
Gotchas
- Requires WP 7.0+. On older WP the REST endpoint 404s and the picker shows a "needs WordPress 7.0" message.
- On vanilla WP 7.0 only
core/*icons are registered; anamespace: "icomoon"filter is a no-op until something registers icons under that namespace. - Storage is just the name — render.php must call into the icon registry server-side to get the actual SVG. Don't store SVG content in post_content.
Example
{ "id": "ctrl_marker",
"type": "icon",
"label": "Bullet icon",
"attributeKey": "marker",
"namespace": "core",
"parentPanelId": "panel" }Every field also takes the keys common to all fields.