W3cubDocs

/WordPress

WP_Theme::_name_sort_i18n( WP_Theme $a, WP_Theme $b ): int

Callback function for usort() to naturally sort themes by translated name.

Parameters

$aWP_Themerequired
First theme.
$bWP_Themerequired
Second theme.

Return

int Negative if $a falls lower in the natural order than $b. Zero if they fall equally.
Greater than 0 if $a falls higher in the natural order than $b. Used with usort().

Source

private static function _name_sort_i18n( $a, $b ) {
	return strnatcasecmp( $a->name_translated, $b->name_translated );
}

Changelog

Version Description
3.4.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme/_name_sort_i18n