Make WordPress Core

Ticket #48439: rest-api.patch

File rest-api.patch, 1.5 KB (added by dlavrenuek, 6 years ago)

patch

  • wp-includes/rest-api.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    356356                global $wp_rewrite;
    357357
    358358                if ( $wp_rewrite->using_index_permalinks() ) {
    359                         $url = get_home_url( $blog_id, $wp_rewrite->index . '/' . rest_get_url_prefix(), $scheme );
     359                        $url = get_site_url( $blog_id, $wp_rewrite->index . '/' . rest_get_url_prefix(), $scheme );
    360360                } else {
    361                         $url = get_home_url( $blog_id, rest_get_url_prefix(), $scheme );
     361                        $url = get_site_url( $blog_id, rest_get_url_prefix(), $scheme );
    362362                }
    363363
    364364                $url .= $path;
    365365        } else {
    366                 $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) );
     366                $url = trailingslashit( get_site_url( $blog_id, '', $scheme ) );
    367367                // nginx only allows HTTP/1.0 methods when redirecting from / to /index.php
    368368                // To work around this, we manually add index.php to the URL, avoiding the redirect.
    369369                if ( 'index.php' !== substr( $url, 9 ) ) {
     
    375375
    376376        if ( is_ssl() ) {
    377377                // If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS.
    378                 if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
     378                if ( $_SERVER['SERVER_NAME'] === parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) {
    379379                        $url = set_url_scheme( $url, 'https' );
    380380                }
    381381        }