WP_REST_Server::add_site_icon_to_index()protectedWP 5.9.0

Exposes the site icon through the WordPress REST API.

This is used for fetching this information when user has no rights to update settings.

Method of the class: WP_REST_Server{}

No Hooks.


null. Ничего (null).


// protected - for code of main (parent) or child class
$result = $this->add_site_icon_to_index( $response );
$response(WP_REST_Response) (required)
REST API response.


Since 5.9.0 Introduced.

WP_REST_Server::add_site_icon_to_index() code WP 6.3

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();