REST API: Avoid unnecessarily preparing item links.

Do not call the `prepare_links` methods in core REST API controllers, unless the `_links` or `_embedded` fields are requested. There is no need to prepare links if they are never returned in the response. This saves resources, as many calls to `prepare_links` methods perform database queries. 

Props Spacedmonkey, timothyblynjacobs, rachelbaker, desrosj, dlh, hellofromTonya.
Fixes #52992.
Built from https://develop.svn.wordpress.org/trunk@53760


git-svn-id: http://core.svn.wordpress.org/trunk@53319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey
2022-07-22 14:00:12 +00:00
parent ee12e8acc0
commit 16dfb05173
22 changed files with 119 additions and 56 deletions

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53759';
$wp_version = '6.1-alpha-53760';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.