0

Starting to build my first plugin and I'm completely puzzled on why the submenu page won't show? The main page shows up, not the subpage.

I've run over the syntax what feels like a million times and I just don't see the gap on what I have here. (Page markup is complete, not shown, I'm just trying to get the menu item to show up.)

/* Create Menu Item */
function core_settings_menu() {

    add_menu_page(
        'Core Settings & Code Manager',
        'Core Settings',
        'manage_options',
        'core-settings-page',
        'core_settings_page_contents',
        'dashicons-superhero',
        90
    );

    add_submenu_page(
        'core-settings-page',
        'Code Snippets',
        'manage-options',
        'core-settings-code-snippets',
        'core_settings_code_snippets_markup'
    );

}

 /* Add Menu To Site */
 add_action( 'admin_menu', 'core_settings_menu' );
1
  • Your second 'manage_options' is incorrect, so it may just be a permissions thing. Commented Jan 23, 2022 at 21:37

1 Answer 1

0

Because the main menu has manage_options but the sub menu has manage-options, it should be _ not -.

Since nobody has the manage-options capability nobody can see that submenu page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.