/**
* Filters the sorted list of menu item objects before generating the menu's HTML.
*
* @since 3.1.0
*
* @param array $sorted_menu_items The menu items, sorted by each menu item's menu order.
* @param stdClass $args An object containing wp_nav_menu() arguments.
*/
$sorted_menu_items =
apply_filters( 'wp_nav_menu_objects',
$sorted_menu_items,
$args );
$items .=
walk_nav_menu_tree( $sorted_menu_items,
$args->depth,
$args );
unset( $sorted_menu_items );
// Attributes.
if ( !
empty( $args->menu_id
) ) { $wrap_id =
$args->menu_id;
} else { $wrap_id = 'menu-' .
$menu->slug;
while ( in_array( $wrap_id,
$menu_id_slugs, true
) ) { if ( preg_match( '#-(\d+)$#',
$wrap_id,
$matches ) ) { $wrap_id =
preg_replace( '#-(\d+)$#', '-' . ++
$matches[1
],
$wrap_id );
}