WordPress.org

Make WordPress Core

Ticket #35580: 35580.1.diff

File 35580.1.diff, 702 bytes (added by danielbachhuber, 4 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 dad4070..f62d41b 100644
    a b class WP_REST_Server { 
    236236                $this->send_header( 'Access-Control-Expose-Headers', 'X-WP-Total, X-WP-TotalPages' );
    237237                $this->send_header( 'Access-Control-Allow-Headers', 'Authorization' );
    238238
     239                $api_root = get_rest_url();
     240                if ( ! empty( $api_root ) ) {
     241                        $this->send_header( 'Link', '<' . esc_url_raw( $api_root ) . '>; rel="https://api.w.org/"' );
     242                }
     243
    239244                /**
    240245                 * Send nocache headers on authenticated requests.
    241246                 *