WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 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 3 years ago.
for edit.php
16341.patch (821 bytes) - added by SergeyBiryukov 3 years ago.
16341.2.patch (5.7 KB) - added by SergeyBiryukov 3 years ago.
16341.3.patch (12.2 KB) - added by SergeyBiryukov 3 years ago.
16341.4.patch (12.2 KB) - added by SergeyBiryukov 3 years ago.
Fixed themes search on Edit Site screen
16341.5.patch (5.7 KB) - added by SergeyBiryukov 3 years ago.
16341.6.patch (5.7 KB) - added by SergeyBiryukov 3 years ago.
16341.7.patch (710 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (26)

scribu3 years ago

for edit.php

SergeyBiryukov3 years ago

comment:1 scribu3 years ago

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

comment:2 follow-up: scribu3 years ago

I like Sergey's patch better.

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

comment:3 scribu3 years ago

  • Description modified (diff)

comment:4 in reply to: ↑ 2 ocean903 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

SergeyBiryukov3 years ago

comment:5 SergeyBiryukov3 years ago

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

Version 0, edited 3 years ago by SergeyBiryukov (next)

comment:6 SergeyBiryukov3 years ago

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

SergeyBiryukov3 years ago

comment:7 SergeyBiryukov3 years ago

  • Keywords has-patch added

comment:8 SergeyBiryukov3 years ago

  • Keywords needs-testing added

SergeyBiryukov3 years ago

Fixed themes search on Edit Site screen

comment:9 follow-up: nacin3 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.

SergeyBiryukov3 years ago

comment:10 in reply to: ↑ 9 SergeyBiryukov3 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.

SergeyBiryukov3 years ago

comment:11 SergeyBiryukov3 years ago

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

comment:12 nacin3 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.

comment:13 SergeyBiryukov3 years ago

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

comment:14 SergeyBiryukov3 years ago

Perhaps search_box() would be appropriate place?

SergeyBiryukov3 years ago

comment:15 SergeyBiryukov3 years ago

OK, here's even more simple patch :)

comment:16 scribu3 years ago

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

comment:17 scribu3 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

comment:18 nacin3 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.