WordPress at a glance
function is not described

WP_Customize_Nav_Menu_Setting::_sort_menus_by_orderby() protected WP 4.3.0

Deprecated from version 4.7.0. It is no longer supported and can be removed in future releases. Use wp_list_sort() instead.

Sort menu objects by the class-supplied orderby property.

This is a workaround for a lack of closures.

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

No Hooks.


Int. Nothing.


// protected - for code of main (parent) or child class
$result = $this->_sort_menus_by_orderby( $menu1, $menu2 );
$menu1(object) (required)
$menu2(object) (required)


  • See: WP_Customize_Nav_Menu_Setting::filter_wp_get_nav_menus()


Since 4.3.0 Introduced.
Deprecated Since 4.7.0 Use wp_list_sort()

Code of WP_Customize_Nav_Menu_Setting::_sort_menus_by_orderby() WP 5.7.2

protected function _sort_menus_by_orderby( $menu1, $menu2 ) {
	_deprecated_function( __METHOD__, '4.7.0', 'wp_list_sort' );

	$key = $this->_current_menus_sort_orderby;
	return strcmp( $menu1->$key, $menu2->$key );