How to avoid creating first submenu page that is same as menu page?

Onixion

I’ve created menu page and four submenu pages.

public function onixion_admin_menu_option() {
add_menu_page('onixion','Onixion','manage_options','onixion-admin- 
menu',array(&$this, 'onixion_main_page' ),'dashicons-chart- 
area','200');
add_submenu_page(
    'onixion-admin-menu', 
    'scripts',
    'Scripts', 
    'manage_options',
    'scripts',
    array(&$this, 'onixion_scripts_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'custom_footer',
    'Custom Footer', 
    'manage_options',
    'custom_footer',
    array(&$this, 'onixion_custom_footer_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'file_upload',
    'File Upload', 
    'manage_options',
    'file_upload',
    array(&$this, 'onixion_file_upload_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'payments',
    'Payments', 
    'manage_options',
    'payments',
    array(&$this, 'onixion_payments_page' ) 
);

}

Everything seems fine, there are those submenu pages with the text I printed to test them individually.

The problem is that the first submenu page is a copy of menu page. What I want is to have different page when someone clicks on main menu option: ‘Onixion’ and to have only submenu pages I’ve added (Without ‘Onixion’ submenu page).

Read more here:: How to avoid creating first submenu page that is same as menu page?

Leave a Reply

Your email address will not be published. Required fields are marked *