Opened 8 years ago
Closed 8 years ago
#45099 closed defect (bug) (fixed)
REST API: Render only additional fields specific to request when _fields= is used
| Reported by: | dlh | Owned by: | danielbachhuber |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.0 |
| Component: | REST API | Version: | 4.9.8 |
| Severity: | normal | Keywords: | has-patch has-unit-tests fixed-5.0 |
| Cc: | Focuses: | rest-api |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 43736: