wppaste
WordPress

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:5407
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()
$orderstringoptional
Either 'ASC' or 'DESC'. Only used if $orderby is a string. Default 'ASC'.Default: 'ASC'
$preserve_keysbooloptional
Whether to preserve keys. Default false.Default: false

Return

array
The sorted array.

Uses · 1

Used by · 6

Source

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 );}

History

Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 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.