plugins - Admin menu hilighting wrong item for CPT

admin2025-06-04  3

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?

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?

Share Improve this question asked Jan 25, 2019 at 9:14 markmoxxmarkmoxx 2211 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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'
);
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748974966a315302.html

最新回复(0)