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

wp_list_sort ›

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

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