_admin_menu
Action HookDescription
Fires before the administration menu loads in the admin. The hook fires before menus and sub-menus are removed based on user privileges.Hook Information
File Location |
wp-admin/includes/menu.php
View on GitHub
|
Hook Type | Action |
Line Number | 41 |
Hook Parameters
This hook doesn't accept any parameters.
Usage Examples
Basic Usage
<?php
// Hook into _admin_menu
add_action('_admin_menu', 'my_custom_function');
function my_custom_function() {
// Your custom code here
}
Source Code Context
wp-admin/includes/menu.php:41
- How this hook is used in WordPress core
<?php
36 * The hook fires before menus and sub-menus are removed based on user privileges.
37 *
38 * @since 2.2.0
39 * @access private
40 */
41 do_action( '_admin_menu' );
42 }
43
44 // Create list of page plugin hook names.
45 foreach ( $menu as $menu_page ) {
46 $pos = strpos( $menu_page[2], '?' );
PHP Documentation
<?php
/**
* Fires before the administration menu loads in the admin.
*
* The hook fires before menus and sub-menus are removed based on user privileges.
*
* @since 2.2.0
* @access private
*/
Quick Info
- Hook Type: Action
- Parameters: 0
- File: wp-admin/includes/menu.php
Related Hooks
Related hooks will be displayed here in future updates.