WordPress/wp-includes/rest-api
spacedmonkey 7d1e95ec7f 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.
Built from https://develop.svn.wordpress.org/trunk@56566


git-svn-id: http://core.svn.wordpress.org/trunk@56078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-13 14:34:20 +00:00
..
endpoints Coding Standards: Include one space after function keyword for closures. 2023-09-12 15:23:18 +00:00
fields REST API: Check post meta update authorization only when value is changed. 2023-06-27 17:26:27 +00:00
search Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:32:23 +00:00
class-wp-rest-request.php Docs: Replace multiple single line comments with multi-line comments. 2023-07-10 23:00:22 +00:00
class-wp-rest-response.php Coding Standards: Always use parentheses when instantiating an object. 2022-11-29 15:51:14 +00:00
class-wp-rest-server.php REST API: Avoid unnecessarily preparing item links REST API index. 2023-09-13 14:34:20 +00:00