title: Adding items to menu not working in multisite
body: <p>I have a custom code that it will automatically add the category to the menu in multisite. Lets say I have a category name "Cat1" then once I run my code this will automatically added to the menu. However 1 issue is that it will added if the blog is loggedin. I want to be added if it is not logging in.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>require( dirname(__FILE__) . '/wp-load.php' );
  require_once( dirname(__FILE__) . '/wp-includes/ms-functions.php');
  require_once( dirname(__FILE__) . '/wp-includes/user.php');
  require_once( dirname(__FILE__) . '/wp-admin/includes/taxonomy.php');
  require_once( dirname(__FILE__) . '/wp-admin/includes/nav-menu.php' );
  
  
  $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' =&gt; "Primary Menu") );
  
  $test = array( 
      array(
      'menu-item-db-id' =&gt; 0,
      'menu-item-object-id' =&gt; 2,
      'menu-item-object' =&gt; 'category',
      'menu-item-parent-id' =&gt; 0,
      'menu-item-type' =&gt; 'taxonomy',
      'menu-item-title' =&gt; 'Rome',
      'menu-item-url' =&gt; 'http://sub.example.com/love/',
      'menu-item-target' =&gt; '',
      'menu-item-classes' =&gt; '', 
      'menu-item-xfn' =&gt; '',
      'menu-item-description' =&gt; ''
      )
  );
  
  
  if($item_ids = wp_save_nav_menu_items( $_nav_menu_selected_id, $test )) {
  
    foreach( $item_ids AS $single_item_id ) {
  
      $my_post = array (
       'ID' =&gt; $single_item_id,
       'post_status' =&gt; 'publish',
       'post_name' =&gt; $single_item_id
      );
  
      wp_update_post($my_post);
  
    }
  }
  
      $menu_locations = array(
          'main-menu' =&gt; $_nav_menu_selected_id,
          'footer-menu' =&gt; $_nav_menu_selected_id
      );
  
  set_theme_mod( 'nav_menu_locations', $menu_locations );
  </code></pre>
  
  <p>If you run above example blog1.mysite.com it will added if I'm logging in on that blog. But if not they it will not added. However if I run it on www.mysite.com (not a subdomain) even if I'm not logging in it will added the category to the menu.</p>