Make WordPress Core


Ignore:
Timestamp:
11/30/2023 02:52:52 PM (2 years ago)
Author:
hellofromTonya
Message:

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].

Props antonvlasenko, hellofromTonya, ironprogrammer, priethor, wildworks.
Fixes #59935.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r57126 r57147  
    12971297            $this->add_site_logo_to_index( $response );
    12981298            $this->add_site_icon_to_index( $response );
     1299        } else {
     1300            if ( rest_is_field_included( 'site_logo', $fields ) ) {
     1301                $this->add_site_logo_to_index( $response );
     1302            }
     1303            if ( rest_is_field_included( 'site_icon', $fields ) || rest_is_field_included( 'site_icon_url', $fields ) ) {
     1304                $this->add_site_icon_to_index( $response );
     1305            }
    12991306        }
    13001307
Note: See TracChangeset for help on using the changeset viewer.