[wp-trac] [WordPress Trac] #45220: register_rest_field() doesn't work when schema is empty

WordPress Trac noreply at wordpress.org
Mon Dec 17 01:14:21 UTC 2018


#45220: register_rest_field() doesn't work when schema is empty
------------------------------------------------+--------------------------
 Reporter:  Dudo                                |       Owner:
                                                |  danielbachhuber
     Type:  defect (bug)                        |      Status:  closed
 Priority:  normal                              |   Milestone:  5.0
Component:  REST API                            |     Version:  5.0
 Severity:  normal                              |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests fixed-5.0  |     Focuses:  rest-api
------------------------------------------------+--------------------------
Changes (by SergeyBiryukov):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"44254" 44254]:
 {{{
 #!CommitTicketReference repository="" revision="44254"
 REST API: Include fields with null schema in `get_fields_for_response()`.

 In [43736], we prevented rendering fields when not present in `?_fields=`.
 However, because `get_fields_for_response()` is dependent on
 `get_item_schema()`, any custom fields registered with a null schema would
 be incorrectly excluded from the response. Because the REST API permits a
 null schema for `register_rest_field()`, those fields should be included
 in the available fields for a response.

 Props danielbachhuber.
 Merges [43908] to trunk.
 Fixes #45220.
 }}}

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


More information about the wp-trac mailing list