[wp-trac] [WordPress Trac] #64844: REST API: Support nested _fields in revisions controller

WordPress Trac noreply at wordpress.org
Thu Mar 12 13:21:28 UTC 2026


#64844: REST API: Support nested _fields in revisions controller
--------------------------+-----------------------
 Reporter:  ellatrix      |       Owner:  ellatrix
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  7.0
Component:  REST API      |     Version:
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------
Changes (by ellatrix):

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


Comment:

 In [changeset:"61987" 61987]:
 {{{
 #!CommitTicketReference repository="" revision="61987"
 REST API: Support nested _fields in revisions controller.

 Use `rest_is_field_included()` instead of `in_array()` for `content`,
 `title`, `excerpt`, and `guid` fields in `WP_REST_Revisions_Controller`.
 This lets clients request specific sub-fields (e.g. `_fields=content.raw`)
 and skip expensive `the_content` rendering.

 The [REST API `_fields` documentation](https://developer.wordpress.org
 /rest-api/using-the-rest-api/global-parameters/#_fields) states that
 nested fields are supported using dot notation. However, the revisions
 controller uses `in_array()` which doesn't match nested keys like
 `content.raw`.

 Developed in: https://github.com/WordPress/wordpress-develop/pull/11230.

 Props ellatrix, andrewserong, mukeshpanchal27.
 Fixes #64844.
 }}}

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


More information about the wp-trac mailing list