WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#16341 closed defect (bug) (fixed)

Sorting is reset after searching

Reported by: scribu Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description (last modified by scribu)

  1. Go to /wp-admin/edit.php
  2. Sort by title
  3. Search for something

The search results are no longer sorted by title.

All list screens are affected.

Attachments (8)

16341.diff (761 bytes) - added by scribu 10 years ago.
for edit.php
16341.patch (821 bytes) - added by SergeyBiryukov 10 years ago.
16341.2.patch (5.7 KB) - added by SergeyBiryukov 10 years ago.
16341.3.patch (12.2 KB) - added by SergeyBiryukov 10 years ago.
16341.4.patch (12.2 KB) - added by SergeyBiryukov 10 years ago.
Fixed themes search on Edit Site screen
16341.5.patch (5.7 KB) - added by SergeyBiryukov 10 years ago.
16341.6.patch (5.7 KB) - added by SergeyBiryukov 10 years ago.
16341.7.patch (710 bytes) - added by SergeyBiryukov 10 years ago.

Download all attachments as: .zip

Change History (26)

@scribu
10 years ago

for edit.php

#1 @scribu
10 years ago

16341.diff fixes the problem for edit.php, but the same needs to be done for all list screens.

#2 follow-up: @scribu
10 years ago

I like Sergey's patch better.

Maybe we should make it a method of WP_List_Table, to avoid code duplication.

#3 @scribu
10 years ago

  • Description modified (diff)

#4 in reply to: ↑ 2 @ocean90
10 years ago

Replying to scribu:

Maybe we should make it a method of WP_List_Table, to avoid code duplication.

+1

ocean90: scribu: Wouldn't be something like $wp_list_table->hidden_fields() nice?
scribu: exactly
ocean90: Which has some default fields and is extendable for example for the edit screen (post_type & post_status)
scribu: yep

#5 @SergeyBiryukov
10 years ago

16341.2.patch should do it for Posts, Media Library, Links, Pages, Comments and Users screens. Going to check Network screens.

Last edited 10 years ago by SergeyBiryukov (previous) (diff)

#6 @SergeyBiryukov
10 years ago

16341.3.patch should do it for Network screens as well.

#7 @SergeyBiryukov
10 years ago

  • Keywords has-patch added

#8 @SergeyBiryukov
10 years ago

  • Keywords needs-testing added

@SergeyBiryukov
10 years ago

Fixed themes search on Edit Site screen

#9 follow-up: @nacin
10 years ago

Not a fan of all the churn here. Let's just add the method and call it hidden_order_fields(), call it everywhere, and don't bother with any other iterations at this point.

#10 in reply to: ↑ 9 @SergeyBiryukov
10 years ago

Replying to nacin:

Let's just add the method and call it hidden_order_fields(), call it everywhere, and don't bother with any other iterations at this point.

Done.

#11 @SergeyBiryukov
10 years ago

16341.6.patch may have better formatting in hidden_order_fields().

#12 @nacin
10 years ago

We can also just sneak the logic into views() probably, as it's called on all the same pages. But thanks for the much simpler patch.

#13 @SergeyBiryukov
10 years ago

views() is currently called outside of the search forms. Not sure how it would help here.

#14 @SergeyBiryukov
10 years ago

Perhaps search_box() would be appropriate place?

#15 @SergeyBiryukov
10 years ago

OK, here's even more simple patch :)

#16 @scribu
10 years ago

I can agree with hidden_order_fields(), but slapping them onto search_box() is wrong, IMO.

#17 @scribu
10 years ago

  • Keywords commit added; needs-testing removed

From IRC:

(07:36:52 PM) nacin: scribu: the first thing I'm doing when 3.1 is released is rearchitecting this mess.

So let's go with 16341.7.patch

#18 @nacin
10 years ago

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

(In [17353]) Add orderby and order hidden fields to each list form, to allow for state. props SergeyBiryukov, fixes #16341.

Note: See TracTickets for help on using tickets.