Opened 10 years ago
Closed 10 years ago
#35120 closed defect (bug) (fixed)
Insert attachment should not always https
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.5 | Priority: | normal |
| Severity: | normal | Version: | 4.6 |
| Component: | Media | Keywords: | https |
| Focuses: | administration | Cc: |
Description
In [35804], WP_CONTENT_URL began to reflect current url scheme.
so, Image url when insert from editor with https (and front is http) will have https.
but some case like using Self-signed certificate, or like local-only ssl admin, admin only ssl... ―― they are not recommended but some user using it ―― the image cannot show in front (non-admin user:viewer)
If wp_get_attachment_url's response filtered like below, it will well but it need some conditional branching.
<?php add_filter('wp_get_attachment_url',function($url) { return set_url_scheme($url ,'http'); });
(p.s. is this a plugin territory?)
Change History (7)
#1
@
10 years ago
- Keywords https needs-patch added
- Owner set to joemcgill
- Status changed from new to reviewing
#2
@
10 years ago
- Keywords reporter-feedback added
- Version changed from trunk to 4.4
@hnle Would you let us know the following please?
- What's the value of the "WordPress Address" and "Site Address" fields on the Settings screen?
- Are you using the
FORCE_SSL_ADMINconstant in yourwp-config.phpfile? - Are you using the
WP_HOMEorWP_SITEURLconstants in yourwp- config.phpfile?
#3
@
10 years ago
@johnbillion
Oh... my current test environment (latest trunk) is multisite...
but its site not using FORCE_SSL_ADMIN (so self input https) and no using their const, and their site-url, home are both like http://subdomain.example.com. (I think it is edge case)
in other side, in the current public env (4.4 stable) which using FORCE_SSL_ADMIN looks not have this issue.
#4
@
10 years ago
- Keywords reporter-feedback removed
- Milestone changed from Awaiting Review to 4.4.1

Hi @hnle,
Thanks for the report. This definitely looks like a bug. WP_CONTENT_URL is used in
wp_upload_dir()to build the URL to the uplods directory, which is then used throughout many functions in core. The one that is affecting you isget_image_tag(), which is used to build the HTML for an image before inserting it into a post.Related history can be found in #15928.