[wp-trac] [WordPress Trac] #37128: Introduce helper function `wp_list_sort()`

WordPress Trac noreply at wordpress.org
Thu Sep 8 04:15:31 UTC 2016


#37128: Introduce helper function `wp_list_sort()`
--------------------------------------+------------------
 Reporter:  flixos90                  |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  4.7
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------

Comment (by jorbin):

 In general, core has tended to not add utility functions that it doesn't
 use.  Is there anywhere in core this would make sense right now?  Not
 saying that should keep it out, but I think if core can use it, the case
 for including it is stronger.

 One thing that isn't obvious from me just reading the tests and the docs
 is what happens if wp_list_sort is called on an object where `$orderby`
 isn't set on each field?  Where does that fall in the sort?  Seems like
 that is something that should be documented and tested so the code remains
 consistent into the future.

 Additionally, what about when you want to do both asc and desc ?  For
 example, alphabetical by title, but reverse chronological? Perhaps there
 should just be a single argument that you pass in that includes both the
 field and the direction?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37128#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list