[wp-trac] [WordPress Trac] #47779: Add a filter to `get_item_schema()` to be able to extend the schema of existing properties

WordPress Trac noreply at wordpress.org
Wed Oct 23 17:05:11 UTC 2019


#47779: Add a filter to `get_item_schema()` to be able to extend the schema of
existing properties
-------------------------------------------------+-------------------------
 Reporter:  luisherranz                          |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  REST API                             |     Version:  4.7
 Severity:  trivial                              |  Resolution:
 Keywords:  has-patch dev-feedback needs-unit-   |     Focuses:  rest-api
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by swissspidy):

 Such a filter seems very crucial for enabling other contexts beyond
 `view`, `edit`, and `embed`, so +1 on adding one.

 I might wanna add a new field for post objects using `register_rest_field`
 that only works in context `foo`, and at the same time also want to use
 some of the existing fields like `id` in that context.
 This doesn't seem to be doable without this proposed filter, as `id` in
 the schema is hardcoded to the `view`, `edit`, and `embed` contexts and
 not available otherwise.

 @kadamwhite Since you chimed in on https://github.com/ampproject/amp-
 wp/issues/1014 originally - do you perhaps have any insights here
 regarding adding and testing such a filter?

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


More information about the wp-trac mailing list