do_action( 'admin_menu', string $context )

Fires before the administration menu loads in the admin.


Parameters Parameters

$context

(string) Empty context.


Top ↑

More Information More Information

  • 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.
  • This action mustn’t be placed in an admin_init action function because the admin_init action is called after admin_menu.

Top ↑

Source Source

File: wp-admin/includes/menu.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Aurovrata Venet

    If you want to change a menu label, you can hook this action and change the global $menu, $submenu values,

    add_action( 'admin_menu', 'change_media_label' );
    function change_media_label(){
      global $menu, $submenu;
      debug_msg($menu);
      $menu[10][0] = 'Photos/Videos';
      $submenu['upload.php'][5][0] = 'All Photos/Videos';
      $submenu['upload.php'][10][0] = 'Upload new';
    }
    
  2. Skip to note 2 content
    Contributed by stevenlinx

    Example migrated from Codex:

    The example comes from the wpautop-control plugin, in which the code 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');
    }
    

You must log in before being able to contribute a note or feedback.