WordPress.org

Ready to get started?Download WordPress

Codex

Plugin API/Action Reference/admin menu

Description

This action is used to add extra submenus and menu options to the admin panel's menu structure. It runs after the basic admin panel menu structure is in place.

Usage

<?php add_action('admin_menu', 'function_name'); ?>

where "function_name" is the name of the function to be called.

Note : This action mustn't be placed in an admin_init action function.

Example

The example comes from the wpautop-control plugin. There, it is used to add an options page to the “Settings” menu.

add_action('admin_menu', 'wpautop_control_menu');

function wpautop_control_menu() {
  add_submenu_page('options-general.php', 'wpautop-control', 'wpautop control', 'manage_options', 'wpautop-control-menu', 'wpautop_control_options');
}

Return to Plugin API/Action Reference