[wp-trac] [WordPress Trac] #35658: Provide additional data for registered meta through register_meta()

WordPress Trac noreply at wordpress.org
Mon Feb 1 21:45:39 UTC 2016


#35658: Provide additional data for registered meta through register_meta()
-------------------------------------------------+-------------------------
 Reporter:  jeremyfelt                           |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Options, Meta APIs                   |  Review
 Severity:  normal                               |     Version:
 Keywords:  needs-unit-tests needs-testing has-  |  Resolution:
  patch                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by jeremyfelt):

 I think the REST API chain looks like this:

 1. Meta is either protected or not protected via the application an auth
 callback or with a `_` prefix.
 2. Both protected and not protected meta can be registered for automatic
 inclusion in a REST API meta endpoint via `register_meta()` with
 "show_in_rest".
 3. If a meta key has been registered with "show_in_rest", it will appear
 in the JSON Schema for the object. If the user is authenticated,
 information on protected meta will also appear in the schema.

 And then:

 * If a meta key has been registered with "show_in_rest", it will be
 available via `REST_API_URL/post/123/meta/`
 * If a meta key has been added as a custom field in
 `register_rest_field()`, it will be available as a property in
 `REST_API_URL/post/123/`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35658#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list