Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/admin menu


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.


<?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, because the admin_init action is called after admin_menu.


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