wp_list_sort() – Sorts an array of objects or arrays based on one or more orderby arguments.
You appear to be a bot. Output may be restricted
Description
Sorts an array of objects or arrays based on one or more orderby arguments.
Usage
$array = wp_list_sort( $input_list, $orderby, $order, $preserve_keys );
Parameters
- $input_list
- ( array ) required – An array of objects or arrays to sort.
- $orderby
- ( string|array ) optional – Optional. Either the field name to order by or an array of multiple orderby fields as `$orderby => $order`. Default empty array.
- $order
- ( string ) optional default: ASC – Optional. Either 'ASC' or 'DESC'. Only used if
$orderby
is a string. Default 'ASC'. - $preserve_keys
- ( bool ) optional – Optional. Whether to preserve keys. Default false.
Returns
array The sorted array.
Source
File name: wordpress/wp-includes/functions.php
Lines:
1 to 10 of 10
function wp_list_sort( $input_list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) { if ( ! is_array( $input_list ) ) { return array(); } $util = new WP_List_Util( $input_list ); return $util->sort( $orderby, $order, $preserve_keys ); }