REST API: Add the missing site_icon_url to the index.

The `site_icon_url` index was supposed to ship with WordPress 5.6, but was [https://github.com/WordPress/gutenberg/pull/22952 never backported to core].

This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/42957 #42957: REST API: Add the missing 'site_icon_url' to the index]

Follow-up to [52080].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54083 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-09-06 14:41:08 +00:00
parent 31fa0c854f
commit 18e1e81dea
3 changed files with 5 additions and 1 deletions

View File

@@ -1308,6 +1308,8 @@ class WP_REST_Server {
$site_icon_id = get_option( 'site_icon', 0 );
$this->add_image_to_index( $response, $site_icon_id, 'site_icon' );
$response->data['site_icon_url'] = get_site_icon_url();
}
/**

View File

@@ -1084,6 +1084,7 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
// Check site logo and icon.
$this->assertArrayHasKey( 'site_logo', $data );
$this->assertArrayHasKey( 'site_icon', $data );
$this->assertArrayHasKey( 'site_icon_url', $data );
}
/**

View File

@@ -10781,7 +10781,8 @@ mockedApiResponse.Schema = {
}
},
"site_logo": 0,
"site_icon": 0
"site_icon": 0,
"site_icon_url": ""
};
mockedApiResponse.oembed = {