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

wp_list_sort ›

wp_list_sort ( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false )
Parameter: (4)
  • (array) $list An array of objects 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.
    Erforderlich: Nein
    Standard: array()
  • (string) $order Optional. Either 'ASC' or 'DESC'. Only used if $orderby is a string.
    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:

Sorts a list of objects, based on one or more orderby arguments.


function wp_list_sort( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
	if ( ! is_array( $list ) ) {
		return array();

	$util = new WP_List_Util( $list );
	return $util->sort( $orderby, $order, $preserve_keys );