Reference › Functions wp_list_sort ( array $input_list , string | array $orderby = array() , string $order = 'ASC' , bool $preserve_keys = false ): array
Since 4.7.0
Source wp-includes/functions.php:5407Parameters Return Uses Used by Source History Sorts an array of objects or arrays based on one or more orderby arguments.
Parameters
$input_listarray An array of objects or arrays to sort.
$orderbystring | arrayoptional Either the field name to order by or an array of multiple orderby fields as $orderby => $order. Default empty array.Default: array()
$orderstring optional Either 'ASC' or 'DESC'. Only used if $orderby is a string. Default 'ASC'.Default: 'ASC'
$preserve_keysbool optional Whether to preserve keys. Default false.Default: false Return
array The sorted array. Source View on Trac ↗ View on GitHub ↗
5407 function wp_list_sort ( $input_list , $orderby = array ( ) , $order = 'ASC' , $preserve_keys = false ) { 5408 if ( ! is_array ( $input_list ) ) { 5409 return array ( ) ; 5410 } 5411 5412 $util = new WP_List_Util ( $input_list ) ; 5413 5414 return $util -> sort ( $orderby , $order , $preserve_keys ) ; 5415 } History Introduced in 4.7.0 . Unchanged from 6.7.7 through 7.1.0.
6.7.7 6.8.8 6.9.7 7.0.4 7.1.0 Signature, return type and hooks compared across 5 parsed releases.
About this page Parsed data Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. Corrections Something wrong on this page? Report it and it gets fixed in the next regeneration.