On this page
WP_REST_Server::add_site_icon_to_index( WP_REST_Response $response )
Exposes the site icon through the WordPress REST API.
Description
This is used for fetching this information when user has no rights to update settings.
Parameters
$responseWP_REST_Response Required-
REST API response.
Source
File: wp-includes/rest-api/class-wp-rest-server.php. View all references
protected function add_site_icon_to_index( WP_REST_Response $response ) {
$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();
}
Related
Uses
| Uses | Description |
|---|---|
| WP_REST_Server::add_image_to_index() wp-includes/rest-api/class-wp-rest-server.php | Exposes an image through the WordPress REST API. |
| get_site_icon_url() wp-includes/general-template.php | Returns the Site Icon URL. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Server::get_index() wp-includes/rest-api/class-wp-rest-server.php | Retrieves the site index. |
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_server/add_site_icon_to_index