How to Add Setting Page in WordPress Plugin

In this tutorial i will described how to add setting page for plugin as a header menu, Normally plugin and theme developer need to provide a setting page for users to customized the plugin or theme option.We need to create administative menu link for this setting page.This tutorial explains how plugin developers can add administration menus and screens.

To add an administration menu, you must follow below three things:

1. Create a function that contains the menu-building code.
2.Register the above function using the “admin_menu” action hook.
3.Create the HTML output for setting page when the menu item is clicked.

Wordpress provide a hooks to add a top level menu in the admin menu sidebar.
The syntex for add top level menu.

Parameters :

$page_title(string) (required)The text to be displayed in the title tags of the page
$menu_title(string) (required)The on-screen name text for the menu
$capability(string) (required)The capability required for this menu to be displayed to the user
$menu_slug(string) (required)The slug name to refer to this menu by (should be unique for this menu).
$functionNoneThe function that displays the page content for the menu page.
$icon_url(string) (optional)TThe url to the icon to be used for this menu.
$position(integer) (optional) The position in the menu order this menu should appear.

Add below code to plugin loader file.

Step 1: Create function to create menu building code.

Step 2: Add hooks to add menu page in the admin menu sidebar.

Important :This function takes a capability which will be used to determine whether or not a page is included in the menu.