add_submenu_page()

Syntax

add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function )

Parameters

ParameterDetails
$parent_slug(string) The slug name for the parent menu (or the file name of a standard WordPress admin page).
$page_title(string) The text to be displayed in the title tags of the page when the menu is selected.
$menu_title(string) The text to be used for the menu.
$capability(string) The capability required for this menu to be displayed to the user.
$menu_slug(string) The slug name to refer to this menu by (should be unique for this menu).
$function(callable) (Optional) The function to be called to output the content for this page.

Remarks

Here are a list of slugs for $parent_slug

Dashboardindex.php
Postsedit.php
Mediaupload.php
Pagesedit.php?post_type=page
Commentsedit-comments.php
Custom Post Typesedit.php?post_type=your_post_type
Appearancethemes.php
Pluginsplugins.php
Usersusers.php
Toolstools.php
Settingsoptions-general.php
Network Settingssettings.php

Here are a list of Roles and Capabilities for $capability

Roles : defines a set of capabilities for a userCapabilities : define what a role can and can not do
Super Admin
Administrator
Editor
Author
Contributor
Subscriber

Example

<?php add_submenu_page( 
    'options-general.php',
    __( 'Page Title', 'text-domain' ),
    __( 'Menu Title', 'text-domain' ),
    'administrator',
    'menu_slug',
    function_name' 
); ?>