WP_List_Util::sort

SummerySummery

Sorts the list, based on one or more orderby arguments.

Syntax

WP_List_Util::sort( string|array $orderby = array(), string $order = 'ASC', bool $preserve_keys = false )

ParametersParameters

$orderby

(string|array) (Optional) Either the field name to order by or an array of multiple orderby fields as $orderby => $order.

Default value: array()

$order

(string) (Optional) Either 'ASC' or 'DESC'. Only used if $orderby is a string.

Default value: 'ASC'

$preserve_keys

(bool) (Optional) Whether to preserve keys.

Default value: false

ReturnReturn

(array) The sorted array.

SourceSource

File: wp-includes/class-wp-list-util.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Introduced.
Scroll to Top