wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_list_sort › WordPress Function

Seit4.7.0
Veraltetn/v
wp_list_sort ( $input_list, $orderby = array(), $order = 'ASC', $preserve_keys = false )
Parameter: (4)
  • (array) $input_list An array of objects or arrays to sort.
    Erforderlich: Ja
  • (string|array) $orderby Optional. Either the field name to order by or an array of multiple orderby fields as `$orderby => $order`. Default empty array.
    Erforderlich: Nein
    Standard: array()
  • (string) $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` is a string. Default 'ASC'.
    Erforderlich: Nein
    Standard: 'ASC'
  • (bool) $preserve_keys Optional. Whether to preserve keys. Default false.
    Erforderlich: Nein
    Standard: false
Gibt zurück:
  • (array) The sorted array.
Definiert in:
Codex:

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



Quellcode

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