To add an menu items to administration menu then you must do three things:

1. create function for building menu

function my_plugin_menu() {
	add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
}

2. Register the above function using the admin_menu action hook.

add_action( 'admin_menu', 'my_plugin_menu' );

3. Create the HTML output for the page displayed when the menu item is clicked

function my_plugin_options() {
	if ( !current_user_can( 'manage_options' ) )  {
		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
	}
	echo '<div class="wrap">';
	echo '<p>Here you can put your own HTML code</p>';
	echo '</div>';
}

That’s it. If you have any query then comment here.

Leave a Reply

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