WordPress - Administration Menus

The WordPress administration page contains a number of menus in the left hand sidebar. This page describes how to add your own options to these.

Declare that menus will exist | Create a new top-level menu | Create a new sub-menu | Function names | Roles and Capabilities | When your page is displayed


Declare that menus will exist

The first thing is to indicate that there are menu options ... but don't actually define them unless the admin page is displayed. When the admin pages are displayed, then the following will define those options Note that two underscores - __(string, dictionary_set) - translates the text into another language (assuming that an appropriate translation file is provided).


Create a new top-level menu


Create a new sub-menu

These aliases (and many more) can be used as indicated in this table (only a few were in the help, the rest were found in the code) It is totally unacceptable that the menu titles in the WordPress help do not match the options in the default theme. On your system, you can determine which files are called just by placing the mouse over each menu option and reading the associated filenames in the status bar.

By default, the first sub-menu will have the same label as the top level selection. To change it, create the first sub-menu with the same ID and function as the top level - the menu_title string will be displayed.


Function names

There are 2 ways to define the function names Filenames


Roles and Capabilities

There are 5 roles and 40 capabilities.

When creating a user, only one of the 5 roles can be set. Same when editing the user profile.

Yet, when browsing the database, some individual capabilities are defined. There is no indication how this is done.

The functions to add and remove capabilities exist in

This is a code example


When your page is displayed

A (page_hook) is returned when using any of the functions that add plugin menu items to the admin menu: add_management_page(), add_options_page(), etc. As a result, there is an option to provide custom headers when one of those options is selected. See - Administrative Actions and Plugin API/Action Reference/admin head-(plugin page) (The difference is explained below.) This code is from admin-header.php, it shows the order the of the actions (thus, explaining the difference).


Author: Robert Clemenzi
URL: http:// mc-computing.com / ISPs / WordPress / Admin_Menus.html