Opened 11 years ago
Closed 10 years ago
#28097 closed defect (bug) (duplicate)
wp_get_attachment_url returning guid when uploads directory not writeable by webserver
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Related to this issue: #26992
In our case we have a setup where we have five machines sharing a WordPress database: an internally-facing machine that's not publicly accessible where new content is created, and four externally-facing machines that serve content to the public.
On the internally-facing machine the webserver has permission to write to wp-content/uploads, on the externally-facing machine the webserver does not. Because wp_get_attachment_url simply checks for $uploads['error'] the correct attachment URL is not returned on the externally-facing machines when $uploads['error'] is true.
It seems that the correct solution here would be only to fail if the error is something other than permissions-related, or if the function is being called only for retrieving existing attachments. This problem occurs on the first of every month, because WP is expecting there to be a new directory for the new month and there isn't one.
Sounds like a duplicate of #26992 (same issue, different circumstances)