#44653 closed defect (bug) (invalid)
wp_upload_dir not obeying HTTPS and forces everything to HTTP
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Media | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
This is a follow-up to #34945.
Bug is still present in 4.7.9. This has even been noted on the docs and a work-a-round is there too: https://developer.wordpress.org/reference/functions/wp_upload_dir/#comment-2576
This is due to a bug with: wp_upload_dir
When using HTTPS it is expected that wp_upload_dir()
will respect the protocol, but it is always returning HTTP for URLs.
To test: setup an HTTPS site then use this in a plugin/theme. It will always return HTTP for the URLs
Change History (5)
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
7 years ago
#3
@
7 years ago
Thank you!
I am using the constants:
define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME'] . '/wordpress'); define('WP_HOME', 'https://' . $_SERVER['SERVER_NAME']);
Just to be safe, I also checked the options table to ensure it is using https://
as well and it is.
#4
@
7 years ago
- Resolution set to invalid
- Status changed from new to closed
Ok, after looking more into this issue. It seems this is due to a special setup I have. I am using a single install of WordPress to serve numerous sites. Each site has it's own wp-content
and this is defined in their configs.
The issue here is that I needed a global config due to how WordPress steps out a directory to locate the config file. This has a constant using http://
which is not obeying the protocol. I am then assigning that custom constant to WP_CONTENT_URL
and that seems to be the culprit.
I have not tested this theory but I feel pretty confident that is the issue. I saw the issue on the docs so immediately assumed. I should have spent more time looking into this. Sorry to waste your time.
Hi @son9ne, welcome to WordPress Trac!
What are your WordPress Address and Site Address in General Settings?
Related: #33092, #44636.