WordPress.org

Make WordPress Core

Ticket #36451: 36451.2.diff

File 36451.2.diff, 636 bytes (added by westonruter, 2 years ago)
  • src/wp-includes/rest-api.php

    diff --git src/wp-includes/rest-api.php src/wp-includes/rest-api.php
    index c831fed7ec..dbf0ac5149 100644
    function get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) { 
    330330                $url = add_query_arg( 'rest_route', $path, $url );
    331331        }
    332332
    333         if ( is_ssl() ) {
     333        if ( is_ssl() || ( is_admin() && force_ssl_admin() ) ) {
    334334                // If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS.
    335335                if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) ) {
    336336                        $url = set_url_scheme( $url, 'https' );