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

WordPress Trac noreply at wordpress.org
Mon Nov 19 14:09:11 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 commit  |     Focuses:  rest-api
---------------------------------------------+-----------------------------
Changes (by danielbachhuber):

 * owner:  (none) => danielbachhuber
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"43908" 43908]:
 {{{
 #!CommitTicketReference repository="" revision="43908"
 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.

 Fixes #45220.
 }}}

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


More information about the wp-trac mailing list