wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_list_sort › WordPress Function

Desde4.7.0
Obsoleton/a
wp_list_sort ( $input_list, $orderby = array(), $order = 'ASC', $preserve_keys = false )
Parâmetros: (4)
  • (array) $input_list An array of objects or arrays to sort.
    Required: Yes
  • (string|array) $orderby Optional. Either the field name to order by or an array of multiple orderby fields as `$orderby => $order`. Default empty array.
    Required: No
    Padrão: array()
  • (string) $order Optional. Either 'ASC' or 'DESC'. Only used if `$orderby` is a string. Default 'ASC'.
    Required: No
    Padrão: 'ASC'
  • (bool) $preserve_keys Optional. Whether to preserve keys. Default false.
    Required: No
    Padrão: false
Retorna:
  • (array) The sorted array.
Definido em:
Codex:

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



Fonte

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