To create a WordPress plugin admin page, I’ll need to first add a menu item in the WP-Admin dashboard.
Instead of creating a totally new item using add_menu_page, I’m going to add my menu item under Settings option with the help of add_options_page function as follows:
<?php
/*
Plugin Name: Noice Plugin
Plugin URI: https://csmumbai.com
Description: This plugin is NOICE!
Author: Omkar Bhagat
Version: 1.0
*/
// ONE
add_action('admin_menu', 'noice_create_menu');
// TWO
function noice_create_menu() {
add_options_page('Noice Plugin Title', 'Noice Plugin Settings', 'administrator', __FILE__, 'noice_settings_page');
}
// THREE
function noice_settings_page() {
echo '<p>Hello, this is a Noice Plugin!</p>';
}
?>
Here’s what I basically did:
- Added an action hook for
admin_menuto callnoice_create_menu noice_create_menucreates an options page for us with the following arguments:- Page Title
- Menu Item Name
- Who can access it?
- Slug name (I used the file name here).
- Function to call to output content on the page
noice_settings_pageoutputs content on the page
This results in the following menu item under the Settings option in WP-Admin dashboard –

And clicking on this new menu items takes me to –

Notice three things here:
- Output content –
Hello, this is a Noice Plugin! - Page title in the tab –
Noice Plugin Title - And the slug at the end of the URL –
noice-plugin.php
This results in a simple WordPress admin page that prints some text. Let’s see how to do more with this in the next post.