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

WordPress Trac noreply at wordpress.org
Fri Sep 29 04:26:14 UTC 2023


#59494: Passing orderby as array in URL results in Notice
----------------------------+-----------------------------
 Reporter:  NomNom99        |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  6.3.1
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 Visiting `/wp-
 admin/edit.php?post_type=page&orderby[menu_order]=ASC&orderby[title]=ASC`
 or
 `/wp-
 admin/edit.php?post_type=page&orderby%5Bmenu_order%5D=ASC&orderby%5Btitle%5D=ASC`
 (URL encoded version) throws the following notice:


 {{{
  Notice: Array to string conversion in
 /Users/siddharth/Sites/osp/app/public/wp-includes/formatting.php on line
 1104
 }}}

 Since multiple values can be passed to `orderby` in `get_posts()` or
 `WP_Query()`, this behaviour should also be consistent via URL.

 There error occurs at this line:
 https://github.com/WordPress/WordPress/blob/master/wp-admin/includes
 /class-wp-list-table.php#L391 because `esc_attr()` expects a string but
 `$_REQUEST['orderby']` is an array.

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


More information about the wp-trac mailing list