Tefeles Ionut
Tefeles Ionut

Reputation: 31

Wordpress sub-menu issue. It doesn't show

I am new with Wordpress. I am trying to make a menu or a plugin I am building. And the sub-menus are not showing anywhere. Can anyone help ?

add_action('admin_menu', 'peewaMenu');

function peewaMenu()
{
        add_menu_page( 'Peewa Serials', 'Peewa Keys', 'manage_options', 'main-peewa', 'peewaMain' );

add_submenu_page('peewaAdd', 'Add new customer', 'Add new customer', 'manage_options', 'main-peewa');
}

function peewaMain(){
        include_once('peewa-admin.php');
}
function peewaAdd(){
        include_once('peewa-addnew.php');
}

Upvotes: 0

Views: 49

Answers (1)

user128161
user128161

Reputation:

As per the docs, it should be:

add_menu_page ( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )

add_submenu_page ( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )

Your parameters do not match up, so they should be:

add_menu_page( 'Peewa Serials', 'Peewa Keys', 'manage_options', 'main-peewa', 'peewaMain' );

add_submenu_page('main-peewa', 'Add new customer', 'Add new customer', 'manage_options', 'main-peewa/1', 'peewaAdd');

Upvotes: 2

Related Questions