Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
darylldoyle opened this issue Apr 3, 2024 · 0 comments
Open

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

darylldoyle opened this issue Apr 3, 2024 · 0 comments

Comments

@darylldoyle
Copy link
Collaborator

darylldoyle commented Apr 3, 2024

Is your enhancement related to a problem? Please describe.

Coming out of #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.

@darylldoyle darylldoyle changed the title Add a standardised way to register post meta Add a standardised way to register post meta and REST fields Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant