From bf068449828b0bf5467dee13a8a957657469d52e Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Mon, 4 Dec 2023 19:44:22 +0000 Subject: [PATCH] REST API: Restore site logo and icon in index. Restores setting the site's logo, icon, and wp-admin's back button image (which defaults to W). Prior to [56566], the site logo and icon were unconditionally added to the index. [56566] changed this by conditionally adding them if either the `_links` or `_embedded` fields were included. However, these fields are not included when using the Site Logo block, as it uses the `site_logo`, `site_icon`, and `site_icon_url` fields instead. This changeset restores the functionality by checking specifically for the `site_*` fields when neither of the `_links` or `_embedded` fields are present. Follow up to [56566]. Reviewed by jorbin. Merges [57147] to the 6.4 branch. Props antonvlasenko, hellofromTonya, ironprogrammer, priethor, wildworks. Fixes #59935. Built from https://develop.svn.wordpress.org/branches/6.4@57154 git-svn-id: http://core.svn.wordpress.org/branches/6.4@56665 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api/class-wp-rest-server.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api/class-wp-rest-server.php b/wp-includes/rest-api/class-wp-rest-server.php index 4304881b16..a1bc4b9171 100644 --- a/wp-includes/rest-api/class-wp-rest-server.php +++ b/wp-includes/rest-api/class-wp-rest-server.php @@ -1294,6 +1294,13 @@ class WP_REST_Server { $this->add_active_theme_link_to_index( $response ); $this->add_site_logo_to_index( $response ); $this->add_site_icon_to_index( $response ); + } else { + if ( rest_is_field_included( 'site_logo', $fields ) ) { + $this->add_site_logo_to_index( $response ); + } + if ( rest_is_field_included( 'site_icon', $fields ) || rest_is_field_included( 'site_icon_url', $fields ) ) { + $this->add_site_icon_to_index( $response ); + } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index f316159f6a..05ad2c4b36 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4.2-alpha-57119'; +$wp_version = '6.4.2-alpha-57154'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.