WordPress at a glance
function is not described

WP_Customize_Widgets::_sort_name_callback() protected WP 3.9.0

Naturally orders available widgets by name.

{} It's a method of the class: WP_Customize_Widgets{}

No Hooks.


Int. Reorder position for the current widget comparison.


// protected - for code of main (parent) or child class
$result = $this->_sort_name_callback( $widget_a, $widget_b );
$widget_a(array) (required)
The first widget to compare.
$widget_b(array) (required)
The second widget to compare.


Since 3.9.0 Introduced.

Code of WP_Customize_Widgets::_sort_name_callback() WP 5.7.2

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