title: wordpress multisite wp_update_nav_menu_item returns $menu_item_db_id but does not show in menu
body: <p>I have a strange problem when using the wp_update_nav_menu_item function in a multisite installation.</p>
  
  <p>It normally works when I execute this from within wp-admin.  However, now I've been tasked with writing a handler script to auto-create a site, add a number of default pages, add a menu and populate the menu with those pages.</p>
  
  <p>Here is the code in question:</p>
  
  <pre><code>$miid = wp_update_nav_menu_item($menu_id, 0, array(
  'menu-item-title' =&gt; $post['post_title'],
  'menu-item-object' =&gt; 'page',
  'menu-item-object-id' =&gt; $pid,
  'menu-item-type' =&gt; 'post_type',
  'menu-item-status' =&gt; 'publish',
  'menu-item-parent-id' =&gt; $navParentID,
  'menu-item-position' =&gt; $post['menu_order']));
  </code></pre>
  
  <p>I've ensured that all of the values passed in to the function are correct and match with those which would be passed in when I call this function from within wp-admin dashboard.</p>
  
  <p>The blog gets created successfully, as do the default pages, and the menu.  When this executes it does return a <code>$menu_item_db_id</code> value indicating it worked successfully but nothing has actually been added to the menu and calling something like <code>print_r(wp_get_nav_menu_object($menu_id));</code> returns nothing.</p>
  
  <p>When I call the same exact function with the same exact inputs from a page within wp-admin everything works fine.</p>
  
  <p>I've considered that perhaps the current blog context was not set correctly and have used this snippet to validate that I'm in the correct blog:</p>
  
  <pre><code>//Ensure we're updating the correct blog
  $blogid = get_current_blog_id();
  switch_to_blog($blogid);
  echo get_current_blog_id()."&lt;br/&gt;"; 
  </code></pre>
  
  <p>Has anyone else encountered this issue?</p>