Skip to content

Field API: support registering custom field types #74858

Open

Description

@oandregal

Part of #61084 and #73076
Follow-up to #73548
Related #74856

What

Add the ability to register custom field types that field authors can use in their block fields declaratively, as in:

{
  id: 'myField',
  type: 'myCustomType'
}

Why

Field types provide defaults for many interactions (sort, edit, render). All of these interactions can already be implemented by the field authors:

{
  id: 'myField',
  type: 'text',
  sort: ( a, b, direction ) => { /* custom sort */ },
  Edit: ({ data, field, onChange }) => { /* custom edit */ }
  render: ( { item } ) => { /* custom render */ }
}

However, fields like that one can't be serialized, which prevents us from using the DataForm API in places where we require a JSON format (block attributes, PHP server-side, etc.). We need to support declarative approach for those scenarios. See, for example, BlockFields where we may need to register a rich-text field type, if it cannot be bundled in DataForm.

How

The first step is to pass a configuration prop to the existing components (DataViews, DataForm, DataViewsPicker) with the custom field types.

A future next step will be to open this up for registration (see).

Activity

  1. added
    [Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond
    on Jan 22, 2026
  2. youknowriad commented on Jan 22, 2026

    @youknowriad
    Contributor

    The DataViews package should export a function to register new controls, it should be along these lines:

    No, I think we should avoid global functions and registries, I'd prefer a "settings" prop instead

  3. youknowriad commented on Jan 22, 2026

    @youknowriad
    Contributor

    Also worth noting that registering fields and registering controls are two different things.

    • Registering fields is a WordPress concern (registering a field for a specific entity...).
    • Registering control is a DataView component concern.
  4. youknowriad commented on Jan 22, 2026

    @youknowriad
    Contributor

    I realize the issue is about field types, this is also a DataViews/DataForm concern so I see it as part of the "settings" prop as well.

  5. oandregal commented on Jan 23, 2026

    @oandregal
    MemberAuthor

    I'd prefer a "settings" prop instead

    Riad and I talked about this, and he shared the lessons learned by the block editor and global registries. There will be situations where consumers want to register/unregister X depending on some context (e.g., different pages), and it becomes a challenge in a SPA.

    Given we're implementing this issue and #74856 to enable BlockFields work (it's core code we control), we're scoping down this issue to only make it work with a settings config for the components (DataViews, DataForm, DataViewsPicker). A future next step will be to open this up via registration.

  6. dmytropetrash commented on Jan 26, 2026

    @dmytropetrash

    Hi there!

    Thanks for bringing this up. To support registering custom field types, you might want to look into extending the existing Field API by adding a registration method. This could allow you to define and register new field types that integrate smoothly with Gutenberg.

    If you’d like, feel free to share a proposal or example code, and the community can help review and improve it. Looking forward to seeing your ideas!

  7. moved this to 🦵 Punted to 7.1 in WordPress 7.0 Editor Taskson Feb 25, 2026
  8. t-hamano commented on Jul 10, 2026

    @t-hamano
    Contributor

    With the release of 7.1 Beta 1 imminent, and there are no activities, I will remove this from the project board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions