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

In this article

Naturally orders available widgets by name.

Parameters

$widget_aarrayrequired
The first widget to compare.
$widget_barrayrequired
The second widget to compare.

Return

int Reorder position for the current widget comparison.

Source

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

Changelog

VersionDescription
3.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.