Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #5795
      efegue
      Member

      Hello,

      I’m creating a sub-menu admin page like this:

         	$pages[] = array(
      		'page_title' => __('Custom Settings')
      		,'menu_title' => __('Settings', 'piklist')
      		,'sub_menu' => 'plugin_parent_slug'
      		,'capability' => 'manage_options'
      		,'menu_slug' => 'my-plugin-settings'
      		,'setting' => 'plugin_settings'
      		,'menu_icon' => plugins_url('piklist/parts/img/piklist-icon.png')
      		,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
      		,'single_line' => true
      		,'default_tab' => 'Basic'
      		,'save_text' => 'Save Demo Settings'
      	);

      The sub-menu is showing up correctly, the problem is that the menu link generated by this is wrong, it’s something like http://wordpress.dev/wp-admin/my-plugin-settings. It should be http://wordpress.dev/wp-admin/admin.php?page=my-plugin-settings, correct?

      If I add it under let’s say “themes.php” submenu, it works perfectly, but in a custom admin_menu, it doesn’t.

    • #5796
      efegue
      Member

      Looks like this works if the main menu is a menu created with piklist admin pages. Cool.

      Anyway, any chance to hide the “Main menu” from the submenu?

    • #5817
      Steve
      Keymaster

      @efegue– Glad it’s working for you. I’m not sure what you mean by “any chance to hide the “Main menu” from the submenu”?

    • #5822
      efegue
      Member

      Let’s call the main menu “My Plugin” and a submenu “Settings”, creating the menu turns out like this:
      My Plugin
      – My Plugin
      – Settings

    • #5823
      Steve
      Keymaster

      The built-in Piklist demos does this. Check out that code.

    • #5824
      efegue
      Member

      Ok, will do. Thanks!

Viewing 5 reply threads
  • The topic ‘Custom admin page for a plugin, menu_slug doesn't work.’ is closed to new replies.