WP_Customize_Widgets::_sort_name_callback( array $widget_a, array $widget_b )

Naturally orders available widgets by name.

Parameters

$widget_a

(array) (Required) The first widget to compare.

$widget_b

(array) (Required) The second widget to compare.

Return

(int) Reorder position for the current widget comparison.

Source

File: wp-includes/class-wp-customize-widgets.php

protected function _sort_name_callback( $widget_a, $widget_b ) {
		return strnatcasecmp( $widget_a['name'], $widget_b['name'] );
	}

Changelog

Version Description
3.9.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_widgets/_sort_name_callback