[wp-trac] [WordPress Trac] #57902: REST API index does not respect fields
WordPress Trac
noreply at wordpress.org
Wed Sep 13 14:32:57 UTC 2023
#57902: REST API index does not respect fields
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner:
| spacedmonkey
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.4
Component: REST API | Version: 6.1
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests early | Focuses: rest-api,
commit | performance
-------------------------------------------------+-------------------------
Changes (by spacedmonkey):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"56566" 56566]:
{{{
#!CommitTicketReference repository="" revision="56566"
REST API: Avoid unnecessarily preparing item links REST API index.
Building upon the changes introduced in [53760], this commit refines the
behavior of the REST API index. Specifically, it addresses performance
concerns related to the unnecessary preparation of item links, such as
site icon and logo links.
Prior to this update, the index controller was invoking the prepare_links
method regardless of whether the _links or _embedded fields were requested
in the response. This led to unnecessary database lookups and decreased
overall performance.
In this commit, we implement a more efficient approach. Now, the
prepare_links method will only be called when the _links or _embedded
fields are explicitly requested in the response. This optimization ensures
that we prepare links only when they are intended for inclusion in the API
response, reducing unnecessary overhead.
By implementing this improvement, we enhance the overall efficiency and
performance of the WordPress core REST API index controller.
Props spacedmonkey, niravsherasiya7707, dlh, mukesh27, costdev,
swissspidy.
Fixes #57902.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57902#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list