Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#12448 closed defect (bug) (fixed)

pagination problem in unattached media page

Reported by: Denis-de-Bernardy Owned by: matdumsa
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.2
Component: Administration Keywords:
Focuses: Cc:


when visiting media / unattached with multiple unattached media, you seem to end up with the wrong number of total pages, as highlighted in the attached screenshot.

Attachments (3)

unattached-media-pages.png (47.7 KB) - added by Denis-de-Bernardy 8 years ago.
upload.diff (415 bytes) - added by matdumsa 8 years ago.
Path for this Ticket.. This patch was made from rev:13795
12448.diff (697 bytes) - added by PeteMall 8 years ago.

Download all attachments as: .zip

Change History (10)

#1 @matdumsa
8 years ago

  • Keywords needs-patch added
  • Milestone changed from 3.0 to 2.9.3
  • Owner set to matdumsa
  • Status changed from new to accepted
  • Version changed from 3.0 to 2.9.2

I confirm the presence of the bug on my version of wordpress as well..

#2 @matdumsa
8 years ago

  • Keywords has-patch added; needs-patch removed

Actually I found the problem..

It lies in wp-admin/upload.php

It seems that the pagination system used by the media is the same as the one used for POSTS.. It relies on information usually provided by the user in the $_GET variable (query string).

The code for everything BUT orphan is the same.. all it does is call wp_edit_attachments_query() which hack the $_GET array into thinking that these values (posts_per_page) where provided.. In our case these values were unset so this is why you see 0..

The attached patch makes the “hack” work even for unattached elements..

BTW this whole pagination code is pretty ugly.. Maybe a re-write would be require to avoid such bugs in the future..


8 years ago

Path for this Ticket.. This patch was made from rev:13795

#3 @nacin
8 years ago

  • Milestone changed from 2.9.3 to 3.0

#4 @ocean90
8 years ago

  • Keywords needs-patch added; has-patch removed

If you use upload.diff you get a wrong number for $wp_query->found_posts. Its the total number of posts and not of the attachments.

8 years ago

#5 @PeteMall
8 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#6 @wpmuguru
8 years ago

(In [14185]) fix page count calc for unattached media, props PeteMall, see #12448

#7 @PeteMall
8 years ago

  • Keywords has-patch needs-testing removed
  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.