title: Wordpress Plugin Development: Add existing Pages to a Nav Menu
body: <p>I'm having a hard time trying to programatically add existing pages to an existing nav menu.</p>
  
  <pre><code>wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' =&gt; $page['Title'],
                                         'menu-item-object' =&gt; 'page',
                                         'menu-item-object-id' =&gt; $pid,
                                         'menu-item-type' =&gt; 'post_type',
                                         'menu-item-status' =&gt; 'publish'));
  </code></pre>
  
  <p>I'm not getting an error in response, but the pages do not get added to the menu.  What am I missing?</p>
  
  <p>UPDATE [FIXED]:</p>
  
  <pre><code>wp_update_nav_menu_item($menu_id, 0, $args);
  $args = 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>Menu order was apparently required to make this work.</p>