Opened 7 years ago
Closed 7 years ago
#45099 closed defect (bug) (fixed)
REST API: Render only additional fields specific to request when _fields= is used
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.0 | Priority: | normal |
| Severity: | normal | Version: | 4.9.8 |
| Component: | REST API | Keywords: | has-patch has-unit-tests fixed-5.0 |
| Focuses: | rest-api | Cc: |
Description
Follow-up to #43874.
#43874 caused only requested _fields to be processed within the core REST controllers' prepare_item_for_response().
However, callbacks added with register_rest_field() still fire during WP_REST_Controller::add_additional_fields_to_object() regardless of the requested _fields.
The attached patch would add a check for the requested fields to add_additional_fields_to_object() before firing the callbacks.
As suggested in Slack, I'm setting the milestone for this ticket to 5.0: https://wordpress.slack.com/archives/C02RQC26G/p1539604416000100.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
In 43736: