wpseek.com
A WordPress-centric search engine for devs and theme authors
_sort_nav_menu_items is private and should not be used in themes or plugins directly.
_sort_nav_menu_items › WordPress Function
Since3.0.0
Deprecated4.7.0
› _sort_nav_menu_items ( $a, $b )
Access: |
|
Parameters: (2) |
|
Returns: |
|
Defined at: |
|
Codex: |
Sort menu items by the desired key.
Related Functions: is_nav_menu_item, wp_get_nav_menu_items, wp_setup_nav_menu_item, wp_save_nav_menu_items, _is_valid_nav_menu_item
Source
function _sort_nav_menu_items( $a, $b ) { global $_menu_item_sort_prop; _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); if ( empty( $_menu_item_sort_prop ) ) return 0; if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) return 0; $_a = (int) $a->$_menu_item_sort_prop; $_b = (int) $b->$_menu_item_sort_prop; if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) return 0; elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) return $_a < $_b ? -1 : 1; else return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); }