wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_list_sort › WordPress Function

Da4.7.0
Deprecaton/a
wp_list_sort ( $input_list, $orderby = array(), $order = 'ASC', $preserve_keys = false )
Parametri: (4)
  • (array) $input_list An array of objects or arrays to sort.
    Richiesto:
  • (string|array) $orderby Optional. Either the field name to order by or an array of multiple orderby fields as `$orderby => $order`. Default empty array.
    Richiesto: No
    Default: array()
  • (string) $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` is a string. Default 'ASC'.
    Richiesto: No
    Default: 'ASC'
  • (bool) $preserve_keys Optional. Whether to preserve keys. Default false.
    Richiesto: No
    Default: false
Ritorna:
  • (array) The sorted array.
Definito a:
Codex:

Sorts an array of objects or arrays based on one or more orderby arguments.



Sorgenti

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