Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33041 closed enhancement (duplicate)

Make get_blogaddress_by_id scheme-aware

Reported by: ad7six's profile AD7six Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Networks and Sites Keywords:
Focuses: multisite Cc:

Description

Currently this method only returns a http link, irrespective of the requested url scheme or site setup.

This patch adds a call to set_url_scheme so that (hopefully) the returned url is https if it's for a https site/setup.

--- wp-includes/ms-blogs.php
+++ wp-includes/ms-blogs.php
@@ -39,7 +39,7 @@ function wpmu_update_blogs_date() {
  */
 function get_blogaddress_by_id( $blog_id ) {
        $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details!
-       return ( $bloginfo ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : '';
+       return ( $bloginfo ) ? esc_url( set_url_scheme( 'http://' . $bloginfo->domain . $bloginfo->path ) ) : '';
 }

Attachments (2)

get_blogaddress_by_id-scheme.diff (545 bytes) - added by AD7six 9 years ago.
with-test.diff (1.3 KB) - added by AD7six 9 years ago.

Download all attachments as: .zip

Change History (3)

@AD7six
9 years ago

#1 @johnbillion
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the report, AD7six! We're already aware of this bug and we're working on it on ticket #14867.

Note that the solution is not for the return URL's scheme to respect the current scheme, but to respect the scheme of the requested blog.

Note: See TracTickets for help on using tickets.