[wp-trac] [WordPress Trac] #45605: REST API: Avoid DB queries from generating sample permalink when possible
WordPress Trac
noreply at wordpress.org
Thu Jan 10 22:53:05 UTC 2019
#45605: REST API: Avoid DB queries from generating sample permalink when possible
--------------------------+---------------------
Reporter: dlh | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.1
Component: REST API | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+---------------------
Comment (by danielbachhuber):
Replying to [comment:6 TimothyBlynJacobs]:
> I think adding something like this to
`WP_REST_Controller::get_fields_for_response()` makes sense.
I'm amenable to this.
> That would essentially extend the `_fields` performance increases to all
requests. After the `_fields` performance enhancement, code would've had
to been updated to be aware that any field may no longer be in the
response when filtering on `rest_prepare_post`. If the code hadn't been
updated, it would be more likely to experience an issue with that change.
I agree. The `_fields` performance change had a minor back-compat break
for `rest_prepare_post`. Given there doesn't seem to be any negative
fallout, it seems reasonable to implement @TimothyBlynJacobs' approach.
Notably, we need to make sure that any fields without a defined context
are still included by default.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45605#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list