Admin menu hilighting wrong item for CPT

I have two admin submenu items for my custom post type, but only the first one, "General Settings", hilights when either submenu page is being viewed.

    add_submenu_page(
        'edit.php?post_type=landingpage',
        "General Settings", 
        "General Settings", 
        'manage_options', 
        "wp_cpt_plugin_page", 
        'my_callback'
    );
    add_submenu_page(
        'edit.php?post_type=landingpage', 
        'Form Settings',
        'Form Settings',
        'manage_options', 
        'wp_cpt_plugin_page&tab=form-settings', 
        'my_callback'
    );

How do I get 'Form Settings' to be hilighted when the page is viewed?

Solutions

Check:

add_submenu_page(
    'edit.php?post_type=landingpage', 
    'Form Settings',
    'Form Settings',
    'manage_options', 
    // This is the menu slug, you can not pass the arguments,
    // if you want to pass arguments then add only one sub menu page and
    // links with arguments, also display content with conditions of passed arguments.
    'wp_cpt_plugin_page-form-settings',
    'my_callback'
);

Similar questions

Wordpress - Highlight the parent menu-item when child menu item page is selected/loaded
I have a basic menu and some of the menu items have submenus. I have very little experience with wordpress and don't have time to dive deeper into the details right now. So my question is, what is the simplest way to highlight the top menu item when the use navigates to one of the submenu pages. (I tried using both javascript and also pure css to s...
top level menu item is also being displayed as sub-menu item
I am new to wordpress development. I am trying to create a plugin but my top-level menu item is also being displayed as sub-menu item.below is my code. I know this is not the best code as per security prospects. I am trying these at my local system. As per above code only "About" and "Today's menu" should be displayed as sub-menu but it is also dis...
Wordpress: Menu item 'forum' disappear when it becomes Current-menu-item
After a number of updates in Wordpress, one of my menu items (Forum (Simple:Press) disappears when I choose this page in my menu. Before the update it works all perfect, and at this moment all my other menu items are working good as well. So Only the Forum menu item gives this problem. By inspecting of elements I saw that the word 'Forum' is missin...
Change parent menu item to display sub-menu item on hover instead of onclick
I have the following situation: I am developing this WordPress theme using BootStrap CSS framework: http://onofri.org/WP_BootStrap/ As you can see, in the header, I have an horizontal main menu that contains the "Super Voice" main voice. Clicking on it appear to you the submenu that contain "Sub Voice" As you can see to see the sub menu I have to c...
add class name to current menu item for childpages of parent item in menu for wordpress
i am using the following code to print a menu of a parent's child pages into a ul li menu. it works great. however i do not have ability to pipe in a classname just for the current page the user is on - same concept wordpress uses for the main menu code - i am curious what i would need to change in this code to pipe in a current menu item classname...
Auto Scroll Page + Close Sidebar After menu item select + Link Menu item with Section Ids(Wordpress - Jquery)
I am trying to create a custom sidebar menu...I have one page site with section on it...Every sidebar menu link should be connected to a specific section.I have created the menu but have two problems: 1) I want to link the menu items with sections ids with the help of jquery. 2) When user click on the menu item inthe sidebar,it should be closed aut...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.