WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been working with Wordpress off and on for years now, but I haven't gotten entirely immersed with the framework. I have no problem creating plugins that use custom post types, but I'm looking to add a new section in the admin that isn't for posts, but rather my own custom tables.

I know how to create the custom tables on installation of the plugin, I'm just looking for the right information to create a new menu section with subsections, but I'm having a hard time finding the answer.

What functions/hooks do I need? I'll figure out the rest after that.

share|improve this question
up vote 0 down vote accepted

Check out the Administration Menus section in the Codex, I actually used it pretty heavily over the last couple days to create a sub-menu and it helped a lot. It goes into detail on the top level menus as well.

You'll specifically need the add_menu_page() function to create the top level menu, as well as the add_submenu_page() function to create the sub menus. From there it's just a matter of meticulously adding options and setting fields.

Also of great help in understanding the flow of things was Otto's WordPress Settings API Tutorial.

share|improve this answer
I just found the functions a bit ago and was trying to get them to work, but they weren't showing because the role I selected isn't formatted correctly. I wish the Codex would spell out what it expect sometimes! Thanks! – Exit Oct 7 '11 at 1:48

Here is a piece of working code i used for my project. i placed this code in a file residing within 'lib' folder. you can also write in your functions file.

$themename = "Ondeweb";
$shortname = "odwb";
$position = '63.3'; 
$icon = $file_dir."/images/wand.png";

add_menu_page($themename, $themename, 'administrator', 'ondeweb-now', 'ondeweb_admin', $icon, $position);

function innUbud_add_subpage() {
        , 'Ads List' 
        , 'Advertisement List'
        , 'manage_options'
        , 'ondeweb-now-advertise'
        , 'advertiseList'

        , 'Home page videos' 
        , 'Home page videos'
        , 'manage_options'
        , 'ondeweb-now-videos'
        , 'videoList'


function advertiseList() {  
    require_once( get_template_directory() . '/lib/advertise.php' );

function videoList() {  
    require_once( get_template_directory() . '/lib/videos.php' );

in the above code, 'ondeweb-now' is the slug for parent menu which is the indication of parent menu for the sub-menus slug (ondeweb-now-advertise & ondeweb-now-videos)

for detailed explanation these are right places to be:- add_menu_page & add_submenu_page

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.