[wp-trac] [WordPress Trac] #59494: Passing orderby as array in URL results in Notice
WordPress Trac
noreply at wordpress.org
Wed Oct 4 12:32:16 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: 4.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
----------------------------+------------------------------
Comment (by LeonidasMilossis):
Props to @pls78 as we paired on this.
We think that we have to cover multiple formats of arrays in query
parameters. There are 2 types of formats we could think of:
* `/wp-
admin/edit.php?post_type=page&orderby[menu_order]=ASC&orderby[title]=ASC`
- the OP's format
* `/wp-
admin/edit.php?post_type=page&orderby[]=menu_order&orderby[]=title&order=asc`
- a different format we noticed that also works
The first one makes `$_REQUEST['orderby']` into:
{{{
array(2) {
["menu_order"]=>
string(3) "ASC"
["title"]=>
string(3) "ASC"
}
}}}
and the second one makes it into:
{{{
array(2) {
[0]=>
string(10) "menu_order"
[1]=>
string(11) "menu_order2"
}
}}}
So, we created a PR that covers both.
Hope this helps!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59494#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list