WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#28097 closed defect (bug) (duplicate)

wp_get_attachment_url returning guid when uploads directory not writeable by webserver

Reported by: jtwg Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Media Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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.

Change History (3)

#1 @SergeyBiryukov
6 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
6 years ago

Sounds like a duplicate of #26992 (same issue, different circumstances)

#3 @wonderboymusic
6 years ago

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

Duplicate of #26992.

Note: See TracTickets for help on using tickets.