diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
index 3585aa7656..6322dd321d 100644
a
|
b
|
class WP_REST_Server { |
1229 | 1229 | $response->add_link( 'help', 'https://developer.wordpress.org/rest-api/' ); |
1230 | 1230 | $this->add_active_theme_link_to_index( $response ); |
1231 | 1231 | $this->add_site_logo_to_index( $response ); |
| 1232 | $this->add_site_icon_to_index( $response ); |
1232 | 1233 | |
1233 | 1234 | /** |
1234 | 1235 | * Filters the REST API root index data. |
… |
… |
class WP_REST_Server { |
1296 | 1297 | } |
1297 | 1298 | } |
1298 | 1299 | |
| 1300 | /** |
| 1301 | * Exposes the site icon through the WordPress REST API. |
| 1302 | * This is used for fetching this information when user has no rights |
| 1303 | * to update settings. |
| 1304 | * |
| 1305 | * @since 5.9.0 |
| 1306 | * |
| 1307 | * @param WP_REST_Response $response REST API response. |
| 1308 | */ |
| 1309 | protected function add_site_icon_to_index( WP_REST_Response $response ) { |
| 1310 | $site_icon_id = get_option( 'site_icon' ); |
| 1311 | $response->data['site_icon'] = $site_icon_id; |
| 1312 | if ( $site_icon_id ) { |
| 1313 | $response->add_link( |
| 1314 | 'https://api.w.org/featuredmedia', |
| 1315 | rest_url( 'wp/v2/media/' . $site_icon_id ), |
| 1316 | array( |
| 1317 | 'embeddable' => true, |
| 1318 | ) |
| 1319 | ); |
| 1320 | } |
| 1321 | } |
| 1322 | |
1299 | 1323 | /** |
1300 | 1324 | * Retrieves the index for a namespace. |
1301 | 1325 | * |