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

Register fields to Wordpress internals #1348

Open
radeno opened this issue Dec 5, 2019 · 6 comments · May be fixed by #1600
Open

Register fields to Wordpress internals #1348

radeno opened this issue Dec 5, 2019 · 6 comments · May be fixed by #1600

Comments

@radeno
Copy link
Contributor

radeno commented Dec 5, 2019

Issue Overview

WP allows register meta fields in similar way as is for PostType or Taxonomy. Main difference is that it doesn't have as many as functions as MetaBox, but it is more or less standardized workflow to define post/term/etc fields.
Most MetaBox can be reinitialized with WP functions https://developer.wordpress.org/reference/functions/register_meta/ or shortcut functions for posts or terms https://developer.wordpress.org/reference/functions/register_post_meta/ https://developer.wordpress.org/reference/functions/register_post_meta/
With sanitizing, name + description (as description field), multiple (single as false) and clone (object or array type) support or clone_as_multiple (single false + object type).

Expected Behavior

Developer can use built-in functions as https://developer.wordpress.org/reference/functions/get_registered_meta_keys/ and all related functions.

Current Behavior

WP doesn't any clue except MetaBox about registered meta fields.

Possible Solution

As Extensions module to MetaBox, no needed in core.

@rilwis
Copy link
Member

rilwis commented Dec 6, 2019

@radeno I read about this meta functions, but to be honest, I didn't find any usage of them. Do you have any example?

@radeno
Copy link
Contributor Author

radeno commented Dec 9, 2019

Not really. But it looks like WP moving from CMS to CMF (what is good). Define functional data blocks (post types, taxonomies and meta fields) and let community to offer UI/UX based on it.
register_metadata makes easier integration with Gutenberg mostly. But it is not limited just to Gutenberg, because it exposes fields to REST API with all CRUD actions.

@rilwis
Copy link
Member

rilwis commented Dec 10, 2019

Thanks for the details. That sounds a good reason to implement this!

@radeno
Copy link
Contributor Author

radeno commented Dec 10, 2019

Yep it is. But it depends which fields/field types are compatible.
Maybe in this issue could be defined schema definitions for each field types.

@vdwijngaert
Copy link

Hi @rilwis, just curious here. Did something change in regards to this feature request? It would be very interesting for a project I'm consulting on if this plugin offered direct integration with the internal metadata functionality.

Would be nice if there was a way to use the custom fields and relations defined by this plugin, register them with WP using register_meta and even map them to the correct JSON Schema (for validation etc). I don't think this is currently implemented in the REST API Add-on, but I can be mistaken, of course.

@rilwis
Copy link
Member

rilwis commented Apr 18, 2023

Hi @vdwijngaert ,

This hasn't been implemented in the plugin. Currently, for using fields with REST API, the MB REST API plugin is enough.

Would you like to contribute to the plugin with this feature?

@rilwis rilwis linked a pull request Aug 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants