I've got this code below working to create a default menu. I was wondering how I would create sub-items/subpages...
// Check if the menu exists
$menu_exists = wp_get_nav_menu_object('Main Menu');
// If it doesn't exist, let's create it.
if( !$menu_exists){
$menu_id = wp_create_nav_menu('Main Menu');
// Set up default menu items
wp_update_nav_menu_item($menu_id, 0, array(
'menu-item-title' => __('Home'),
'menu-item-type' => 'post_type',
'menu-item-object' => 'page',
'menu-item-url' => get_permalink($pageId),
'menu-item-status' => 'publish'));
}
[edit] Sorry all! I forgot to mention that I was implementing this menu on every installation of a Wordpress multisite. So when you do a new installation this default menu would already be in place.
wp_nav_menu()
?