简体   繁体   中英

WordPress 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?

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'
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM