This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_bp_nav_menu_sort( array $a, array $b )

Sort BuddyPress nav menu items by their position property.


This is an internal convenience function and it will probably be removed in a later release. Do not use.



(array) (Required) First item.


(array) (Required) Second item.


(int) Returns an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.


File: bp-core/bp-core-template.php

function _bp_nav_menu_sort( $a, $b ) {
	if ( $a['position'] == $b['position'] ) {
		return 0;
	} elseif ( $a['position'] < $b['position'] ) {
		return -1;
	} else {
		return 1;


Version Description
BuddyPress 1.7.0 Introduced.


We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.