[wp-trac] [WordPress Trac] #59494: Passing orderby as array in URL results in Notice

WordPress Trac noreply at wordpress.org
Thu Apr 18 09:35:19 UTC 2024


#59494: Passing orderby as array in URL results in Notice
----------------------------+---------------------
 Reporter:  NomNom99        |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  6.6
Component:  Administration  |     Version:  4.0
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+---------------------

Comment (by LeonidasMilossis):

 Applied @peterwilsoncc's feedback in the PR and have it in more refined
 state (I hope).

 The current functionality added can be described likeso:

 Like said above, an orderby parameter can be passed as an array in two
 ways:
 * `/wp-
 admin/edit.php?post_type=page&orderby[menu_order]=ASC&orderby[title]=ASC`
 - the "associative" way
 * `/wp-
 admin/edit.php?post_type=page&orderby[]=menu_order&orderby[]=title&order=asc`
 - the "non-associative" way

 The PR adds support for both.

 To be more complete, for each case it adds hidden fields for each element
 of the array in the following way:


 {{{
 <input type="hidden" name="orderby[menu_order]" value="ASC">
 <input type="hidden" name="orderby[title]" value="ASC">
 }}}
 for the "associative" way

 and
 {{{
 <input type="hidden" name="orderby[0]" value="menu_order">
 <input type="hidden" name="orderby[1]" value="title">
 <input type="hidden" name="order" value="asc">
 }}}
 for the "non-associative" way.

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


More information about the wp-trac mailing list