WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#12999 closed defect (bug) (fixed)

Viewing unattached attachments results in 404

Reported by: ryan Owned by: ryan
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Security Keywords:
Focuses: Cc:

Description

Got to Media -> Library. Click on the "View" link of an Unattached item. Note that a 404 results. In 2.9 the attachment page was displayed rather than issuing a 404.

This is due to the modified post status checking in the "Check post status to determine if post should be displayed" block of WP_Query::get_posts(). Unattached attachments have a post status of 'inherit' but a post_parent of 0, meaning there is no parent from which to inherit status. In 2.9 the implicit status for unattached attachments was published. In 3.0 the implicit status is private. Which is preferred?

Change History (4)

comment:1 ryan4 years ago

If we want unattached attachments to be public, get_post_status() could return 'publish' if the status of a post is inherit, the post type is attachment, and the parent is 0.

comment:2 jane4 years ago

I like the old 2.7 way. It is established behavior and it's the way we should trend, in anticipation of ultimately having better media features. The whole "you can upload an image without attaching it to a post" was a big deal in 2.7, and this would be a step backward from it. The only thing that would be good to add would be the ability to give a media file a status (draft/published), but obviously 3.0 is too far gone for that, so we should consider it in 3.1.

comment:3 ryan4 years ago

I think, ultimately, we may want to ditch the 'inherit' status, at least for unattached attachments. Rolling with the implementation noted above.

comment:4 ryan4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14087]) Assume unattached attachments are published. fixes #12999

Note: See TracTickets for help on using tickets.