WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#27532 closed defect (bug) (fixed)

Display for Unattached Media showing all images (instead of just unattached)

Reported by: Ipstenu Owned by: nacin
Milestone: 3.9 Priority: highest omg bbq
Severity: blocker Version: 3.9
Component: Media Keywords: has-patch
Focuses: Cc:

Description

Reproduced this on 3 installs, does not happen on 3.8.1

Go into Media Library, click on 'Unattached'

The count (in my case 3) is correct. The images are not.

All images:

https://i.cloudup.com/ChFfxujvUr-3000x3000.png

Unattached images:

https://i.cloudup.com/5Ey9KMCHRo-3000x3000.png

Attachments (2)

27532.patch (1.1 KB) - added by SergeyBiryukov 7 years ago.
27532.2.patch (585 bytes) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @samuelsidler
7 years ago

  • Milestone changed from Awaiting Review to 3.9

#2 @SergeyBiryukov
7 years ago

Confirmed.

#3 @samuelsidler
7 years ago

  • Priority changed from normal to highest omg bbq
  • Severity changed from normal to minor

I can reproduce this as well. Definite regression. Blocker.

#4 @SergeyBiryukov
7 years ago

  • Keywords has-patch added
  • Severity changed from minor to blocker

Introduced in [27373]: trunk/src/wp-admin/includes/post.php?rev=27690#L995.

$q['post_parent'] = 0 doesn't work as expected in WP::parse_request(), because it's not declared as a public or a private query var. It ends up in $extra_query_vars and is not passed to WP_Query::get_posts().

27532.patch fixes that, but we can probably just revert that part of [27373].

#5 @SergeyBiryukov
7 years ago

The wp() call comes from [2646], [3564], and [6910].

We could probably use query_posts() directly instead: 27532.2.patch.

Still, not including post_parent in $private_query_vars seems like an omission.

#6 @nacin
7 years ago

Switching to query_posts() would break a ton, and it'd be insecure. wp() keeps things safe for us.

Adding post_parent as a private query var is fine.

#7 @nacin
7 years ago

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

In 27782:

Add post_parent to the private query vars list. Fixes detached media queries.

props SergeyBiryukov.
fixes #27532.

Note: See TracTickets for help on using tickets.