[wp-trac] [WordPress Trac] #43874: REST API: Only render fields specific to request when _fields= is used

WordPress Trac noreply at wordpress.org
Fri Jul 13 06:50:54 UTC 2018


#43874: REST API: Only render fields specific to request when _fields= is used
---------------------------------------------+-----------------------------
 Reporter:  danielbachhuber                  |       Owner:  (none)
     Type:  defect (bug)                     |      Status:  new
 Priority:  normal                           |   Milestone:  4.9.8
Component:  REST API                         |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  rest-api,
                                             |  performance
---------------------------------------------+-----------------------------

Comment (by pento):

 In [changeset:"43445" 43445]:
 {{{
 #!CommitTicketReference repository="" revision="43445"
 REST API: Filter responses based on the `_fields` parameter, before data
 is processed.

 Historically, the REST API would generate the entire response object,
 including running expensive filters, then it would apply the `_fields`
 parameter, discarding the fields that weren't specificed.

 This change causes `_fields` to be applied earlier, so that only requested
 fields are processed.

 Merges [43087] to the 4.9 branch.

 Props danielbachhuber.
 See #43874.
 }}}

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


More information about the wp-trac mailing list