Make WordPress Core

Ticket #52321: 52321-1.diff

File 52321-1.diff, 2.7 KB (added by palmiak, 3 years ago)
  • src/wp-includes/rest-api/class-wp-rest-server.php

    diff --git a/src/wp-includes/rest-api/class-wp-rest-server.php b/src/wp-includes/rest-api/class-wp-rest-server.php
    index 3585aa7656..6322dd321d 100644
    a b class WP_REST_Server { 
    12291229                $response->add_link( 'help', 'https://developer.wordpress.org/rest-api/' );
    12301230                $this->add_active_theme_link_to_index( $response );
    12311231                $this->add_site_logo_to_index( $response );
     1232                $this->add_site_icon_to_index( $response );
    12321233
    12331234                /**
    12341235                 * Filters the REST API root index data.
    class WP_REST_Server { 
    12961297                }
    12971298        }
    12981299
     1300        /**
     1301         * Exposes the site icon through the WordPress REST API.
     1302         * This is used for fetching this information when user has no rights
     1303         * to update settings.
     1304         *
     1305         * @since 5.9.0
     1306         *
     1307         * @param WP_REST_Response $response REST API response.
     1308         */
     1309        protected function add_site_icon_to_index( WP_REST_Response $response ) {
     1310                $site_icon_id                = get_option( 'site_icon' );
     1311                $response->data['site_icon'] = $site_icon_id;
     1312                if ( $site_icon_id ) {
     1313                        $response->add_link(
     1314                                'https://api.w.org/featuredmedia',
     1315                                rest_url( 'wp/v2/media/' . $site_icon_id ),
     1316                                array(
     1317                                        'embeddable' => true,
     1318                                )
     1319                        );
     1320                }
     1321        }
     1322
    12991323        /**
    13001324         * Retrieves the index for a namespace.
    13011325         *