From e59aaa4f6712ce088c293bb2947c3204ef7d7f5b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Mon, 4 May 2015 13:10:27 +0000 Subject: [PATCH] Attachment URLs should only be forced to SSL on the front end. Detecting SSL status on the Dashboard introduces problems when writing content that is saved to the database and then displayed on the front end, where SSL may be optional (or impossible, due to self-signed certificates). The new approach parallels the logic in `get_home_url()` for forcing HTTPS. See [31614] #15928 for background. Fixes #32112 for trunk. Built from https://develop.svn.wordpress.org/trunk@32342 git-svn-id: http://core.svn.wordpress.org/trunk@32313 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 9 +++------ wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 7b6575366a..d0ecd2e04e 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -4992,12 +4992,9 @@ function wp_get_attachment_url( $post_id = 0 ) { $url = get_the_guid( $post->ID ); } - /* - * If currently on SSL, prefer HTTPS URLs when we know they're supported by the domain - * (which is to say, when they share the domain name of the current SSL page). - */ - if ( is_ssl() && 'https' !== substr( $url, 0, 5 ) && parse_url( $url, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) { - $url = set_url_scheme( $url, 'https' ); + // On SSL front-end, URLs should be HTTPS. + if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] ) { + $url = set_url_scheme( $url ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 794dfb907b..7d599bd82c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32341'; +$wp_version = '4.3-alpha-32342'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.