WordPress at Your Fingertips
function is not described

WP_REST_Server::add_site_logo_to_index() protected WP 5.8.0

Exposes the site logo through the WordPress REST API. This is used for fetching this information when user has no rights to update settings.

{} It's a method of the class: WP_REST_Server{}

No Hooks.

Return

null. Nothing.

Usage

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

Changelog

Since 5.8.0 Introduced.

Code of WP_REST_Server::add_site_logo_to_index() WP 5.8.2

protected function add_site_logo_to_index( WP_REST_Response $response ) {
	$site_logo_id                = get_theme_mod( 'custom_logo' );
	$response->data['site_logo'] = $site_logo_id;
	if ( $site_logo_id ) {
		$response->add_link(
			'https://api.w.org/featuredmedia',
			rest_url( 'wp/v2/media/' . $site_logo_id ),
			array(
				'embeddable' => true,
			)
		);
	}
}