[wp-trac] [WordPress Trac] #36451: get_rest_url() not returning SSL version of the URL when the home_url it's a subdomain
WordPress Trac
noreply at wordpress.org
Fri Jan 13 17:17:29 UTC 2017
#36451: get_rest_url() not returning SSL version of the URL when the home_url it's
a subdomain
-------------------------+-------------------------------------------------
Reporter: nicholas_io | Owner:
Type: defect | Status: reopened
(bug) | Milestone: Awaiting Review
Priority: normal | Version: 4.4
Component: REST API | Resolution:
Severity: major | Focuses: administration, multisite, rest-
Keywords: | api
-------------------------+-------------------------------------------------
Comment (by nicholas_io):
It's been a while that I debug this but it looks like get_rest_url call
get_home_url passing 'rest' scheme (I'm not sure what that means exactly)
but that caused the url to be returned without https and the quoted block
failed to set the https scheme due to @igmoweb explanation.
BTW, this is how I fixed this issue: forcing https using the rest_url
{{{#!php
<?php
add_filter( 'rest_url', function( $url ) {
if ( is_ssl() ) {
$url = set_url_scheme( $url, 'https' );
return $url;
}
return $url;
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36451#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list