do_action( 'admin_menu', string $context )
Fires before the administration menu loads in the admin.
Parameters
-
$context
string -
Empty context.
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.
Source
File: wp-admin/includes/menu.php
.
View all references
do_action( 'admin_menu', '' );
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
If you want to change a menu label, you can hook this action and change the
global $menu, $submenu values
,This snippet add admin menu and submenu HTML content
Let’s say you’re building a plugin and you need to register an overview or dashboard menu option for your plugin page, you can do it like so:
You may come across the fact that deleting items having the slug like admin.php?page=jetpack in the admin_menu hook does not affect the menu in any way and the items remain in their places. To fix it, define correct slugs to delete with remove_menu_page() function.
Try this code:
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.