Core Function
View Source on Trac ↗ wp_list_sort()
wp_list_sort(
mixed $input_list,
mixed $orderby = array(),
mixed $order = 'ASC',
mixed $preserve_keys = false
) Sorts an array of objects or arrays based on one or more orderby arguments.
Parameters 3 required
| Name / Type | Description |
|---|---|
| $input_list array | An array of objects or arrays to sort. Required |
| mixed | (string | array) $orderby Optional. Either the field name to order by or an array of multiple orderby fields as `$orderby => $order`. Default empty array. Required |
| string | $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` is a string. Default 'ASC'. Required |
| $preserve_keys bool | Optional. Whether to preserve keys. Default false. |
Return Value
(array)
The sorted array.
Function Information
Since Version
4.7.0
Source File
wp-includes/functions.php
Advertisement