Skip to content

Add a standardised way to register post meta and REST fields #6

Description

@darylldoyle

Is your enhancement related to a problem? Please describe.

Coming out of 10up/wp-scaffold#218 @nicholasio asked the following:

Could we add a more structured way for registering custom fields? I'd love to use register_rest_field and/register_meta registering custom fields in this way where you also declare the "schema" makes things easier for headless projects. I'm thinking mostly from a REST API standpoint and not really thinking about us creating a wrapper around rendering the custom fields in the editor.

The end goal here is to make sure we're consistent in how we are exposing custom fields through the REST API. There are lots of ways to do it and it doesn't always get added to the REST API schema.

See this for example: https://github.com/10up/headstartwp/blob/develop/wp/headless-wp/includes/classes/Preview/PreviewLink.php#L36

This is a great opportunity to look at providing a better way to register post meta within the scaffold.

Whatever we provide must be easy-to-use, whilst being flexible for those who need to utilize all options.

This issue is here to discuss approaches before any implementation happens.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions