WordPress.org

Ready to get started?Download WordPress

Forums

add_menu_page without root output (2 posts)

  1. wesg
    Member
    Posted 2 years ago #

    On the main WP admin sidebar, most root pages don't show a page for their top element. For example, the last entry is "Settings", but if you click Settings, the first panel is actually "General". How can I replicate this with my plugin? I tried omitting the function name in the action hook, but that goes to a completely different page.

  2. wesg
    Member
    Posted 2 years ago #

    Answer was found on the Administration Menu wiki

    In situations where a plugin is creating its own top-level menu, the first submenu will normally have the same link title as the top-level menu and hence the link will be duplicated. The duplicate link title can be avoided by calling the add_submenu_page function the first time with the parent_slug and menu_slug parameters being given the same value.

    So essentially the add_submenu_page parameters are:

    add_submenu_page('root_page_slug', 'Page Title', 'Menu Title', 'administrator', 'root_page_slug', 'submenu_page_slug');

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.