sort_menu

函数


sort_menu ( $a, $b )
参数
  • (array)
    $a
    Required:
  • (array)
    $b
    Required:
返回值
  • (int)
定义位置
  • wp-admin/includes/menu.php
    , line 305
引入
弃用
function sort_menu( $a, $b ) {
		global $menu_order, $default_menu_order;
		$a = $a[2];
		$b = $b[2];
		if ( isset( $menu_order[ $a ] ) && ! isset( $menu_order[ $b ] ) ) {
			return -1;
		} elseif ( ! isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) {
			return 1;
		} elseif ( isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) {
			if ( $menu_order[ $a ] == $menu_order[ $b ] ) {
				return 0;
			}
			return ( $menu_order[ $a ]