WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#32186 closed defect (bug) (duplicate)

URL Scheme on media attachments is incorrectly set to https when administration performed over SSL

Reported by: khlo Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Media Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

My site is set up as follows:

  • Administration is performed at https://example.com/wp-admin. This uses a self-signed SSL certificate to protect against eavesdropping (e.g. on public wi-fi).
  • The front-end is accessed through http://example.com.
  • Our WordPress siteurl is set to http://example.com.
  • We use define('FORCE_SSL_ADMIN', true); in wp-config.php to enforce SSL on the admin (but not on the front-end).

In WordPress 4.2, changeset [31614] was introduced to fix ticket #15928.

Unfortunately, this has broken images on our website. As administration is being performed over SSL, wp_get_attachment_url() returns an image with the https:// URL schema. This is then saved in the post. When readers access the post through our http front-end, images will not load as the img src attribute uses https (not available due to the self-signed certificate).

Expected behaviour: wp_get_attachment_url() should use the same URL schema as siteurl (i.e. it should use the http schema as we've specifically set this in our siteurl).

Change History (2)

#1 @boonebgorges
4 years ago

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

Thanks for the report, khlo. We're tracking this issue at #32112. See especially https://core.trac.wordpress.org/ticket/32112#comment:14 and later.

#2 @SergeyBiryukov
4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.