title: WordPress admin: How can I display existing admin sub-menu based on user's role
body: <p>I require to show an existing sub-menu item of admin menu based on a specific user role. The role is <code>general-travel-editor</code>.</p>
  
  <p>The actual menu layout is like this</p>
  
  <blockquote>
    <p>Travel Settings<br>
    - General settings<br>
    - Advanced Settings</p>
  </blockquote>
  
  <p>The above user role is supposed access only the "General Settings" sub-menu. So I want to display the menu for this type users as:</p>
  
  <blockquote>
    <p>Travel Settings<br>
    - General settings</p>
  </blockquote>
  
  <p>I tried <code>add_menu_page( 'Travel Settings', 'Travel Settings', 'general-travel-editor', 'general-travel-editor');</code> but I don't have the option to add the URL of this page.</p>
  
  <p>I am using a VIP plugin.
  I need to deliver this by tonight but got stuck!</p>
  
  <p>Somebody please advise how I can do this.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>User role and capabilities defined in functions.php</p>
  
  <pre><code>function general_travel_user_capabilities() {
      $travel_option_caps = array(
          'publish_travel-options'        =&gt; true,
          'edit_travel-options'           =&gt; true,
          'edit_others_travel-options'    =&gt; true,
          'edit_travel-option'            =&gt; true,
          'read_travel-option'            =&gt; true,
          'delete_travel-options'     =&gt; true,
          'delete_travel-option'          =&gt; true,
          'read'                          =&gt; true
      );
  
      wpcom_vip_duplicate_role('subscriber', 'travel-option-editor', 'Travel Option Editor', $travel_option_caps);
  
      $travel_option_caps = array(
          'publish_travel-options',
          'edit_travel-options',
          'edit_others_travel-options',
          'delete_travel-options',
          'delete_others_travel-options',
          'read_private_travel-options',
          'edit_travel-option',
          'delete_travel-option',
          'read_travel-option'
      );
  
      wpcom_vip_add_role_caps('editor', $travel_option_caps);
      wpcom_vip_add_role_caps('administrator', $travel_option_caps);
  }
  
  add_action('init', 'general_travel_user_capabilities');
  </code></pre>
  
  <p>Travel Settings:</p>
  
  <pre><code>function travel_setting_pages_init() {
      $travel_settings = travel_create_settings_page(
          'travel_settings_page',
          'Global Travel Settings',
          array(
              'parent'   =&gt; false,
              'title'    =&gt; 'Travel Settings',
              'position' =&gt; '59.4815152342',
          ),
          array(
              'travel_theme_options'   =&gt; array(
                  'title'       =&gt; '',
                  'description' =&gt; 'Settings that affect all pages of the site',
                  'fields'      =&gt; array(
                      'mytravel_root_url'   =&gt; array(
                          'type'        =&gt; 'url',
                          'label'       =&gt; 'MyTravel Root URL',
                          'description' =&gt; 'The base url for all MyTravel App links',
                          'default'     =&gt; 'http://myurl.com',
                      ),
                      'travel_phone' =&gt; array(
                          'type'        =&gt; 'text',
                          'label'       =&gt; 'Support Phone Number U.S.',
                          'description' =&gt; 'In top left of all pages',
                          'default'     =&gt; '800-610-6500',
                      ),
                      'travel_phone_canada' =&gt; array(
                          'type'        =&gt; 'text',
                          'label'       =&gt; 'Support Phone Number Canada',
                          'description' =&gt; 'In top left of all pages',
                          'default'     =&gt; '877-330-3321',
                      ),
                      'travel_weather_text' =&gt; array(
                          'type'        =&gt; 'text',
                          'label'       =&gt; 'Alert Text',
                          'description' =&gt; 'Text for the alert on the home page. Required for the alert to be displayed.',
                          'default'     =&gt; '',
                      ),
                      'travel_weather_link' =&gt; array(
                          'type'        =&gt; 'url',
                          'label'       =&gt; 'Alert Link',
                          'description' =&gt; 'Link for the alert on the home page. Required for the alert to be displayed.',
                          'default'     =&gt; '',
                      ),
                      'travel_weather_start_date' =&gt; array(
                              'type'        =&gt; 'date',
                              'label'       =&gt; 'Alert Start Date',
                              'description' =&gt; 'Start date to display the alert on the home page. Optional.',
                              'default'     =&gt; '',
                      ),
                      'travel_weather_end_date' =&gt; array(
                              'type'        =&gt; 'date',
                              'label'       =&gt; 'Alert end Date',
                              'description' =&gt; 'End date to display the alert on the home page. Optional.',
                              'default'     =&gt; '',
                      )
                  )
              )
          )
      );
  
      // Home Page Settings Sub-Page
      $slide_color_options = array(
              'orange-grunge' =&gt; 'Orange Grunge Pattern',
              'orange-img1' =&gt; 'Orange Image: Truck Engine with Person',
              'orange-img2' =&gt; 'Orange Image: Truck Top with Person',
              'orange-img3' =&gt; 'Orange Image: Forklift',
              'orange-trailers' =&gt; 'Orange Image: Truck Trailers',
              'black-trails' =&gt; 'Black Image: Light Trails',
              'dark-grey' =&gt; 'Grey Image: Hand',
              'white' =&gt; 'White Image: Trucks in Dock',
  
              'orange' =&gt; 'Orange (To be removed)',
              'blue' =&gt; 'Blue (To be removed)',
              'black' =&gt; 'Black (To be removed)'
      );
      $travel_home_settings = travel_create_settings_page(
          'travel_home_settings_page',
          'Home Page Settings',
          array(
              'parent' =&gt; 'travel_settings_page',
              'title'  =&gt; 'Home Page Settings',
          ),
          array(
              'travel_home_slideshow_settings' =&gt; array(
                  'title'       =&gt; 'Home Slideshow Settings',
                  'description' =&gt; 'If image is not set, slide will not be shown.',
                  'fields'  =&gt; array(
                      // Slide 1
                      'slide_color_1'   =&gt; array(
                          'type'    =&gt; 'radio',
                          'label'   =&gt; 'Slide 1 Background Color',
                          'default' =&gt; 'orange',
                          'options' =&gt; $slide_color_options
                      ),
                      'slide_image_1'   =&gt; array(
                          'type'        =&gt; 'media',
                          'label'       =&gt; 'Slide 1 Image',
                          'description' =&gt; 'Transparent PNG @ 911x375. See travel-home-marquee-template.psd',
                      ),
                      'slide_heading_1' =&gt; array(
                          'type'        =&gt; 'textarea',
                          'label'       =&gt; 'Slide 1 Heading',
                      ),
                      'slide_sub_heading_1' =&gt; array(
                          'type'        =&gt; 'wysiwyg',
                          'label'       =&gt; 'Slide 1 Sub-Heading',
                      ),
                  )
              ),
              'travel_home_mid_cta_settings' =&gt; array(
                  'title'   =&gt; 'Middle CTA Settings',
                  'fields'  =&gt; array(
                      'mid_cta_heading_1_1' =&gt; array(
                          'type'        =&gt; 'text',
                          'label'       =&gt; 'Middle CTA 1 - First Line',
                      ),
                  )
              ),
              'travel_home_lower_cta_settings' =&gt; array(
                  // first block
                  'title'   =&gt; 'Lower CTA Settings',
                  'fields'  =&gt; array(
                      'lower_cta_image_1'   =&gt; array(
                          'type'        =&gt; 'media',
                          'label'       =&gt; 'Lower CTA 1 - Header Image',
                          'description' =&gt; 'Transparent PNG @ 193x71. If set, overrides main heading text.',
                      ),
                  )
              )
          )
      );
  }
  add_action( 'init', 'travel_setting_pages_init' );
  </code></pre>
  
  <p><code>travel-option</code> is a Custom Post Type so I could use it in <code>caps</code> array. When logging in with the said user role I can see the CPT menus are coming up nicely but how can I add this settings menu? I apologize for posting such a long code!</p>