WordPress

Cleaning up the WordPress admin menu

Hide menu items your clients do not need, straight from your theme or a small plugin.

rc
Théo « rootcause »
dev web & performance · updated Jan 2025
This guide revisits and updates an original tutorial from noiretaya.com (log.noiretaya.com/165, /166, /178). The code has been refreshed for current versions.

Remove top-level menu items

Hook into admin_menu and call remove_menu_page() with the menu slug.

add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php'); // Comments
    remove_menu_page('tools.php');         // Tools
    remove_menu_page('edit.php?post_type=page'); // Pages
}, 999);

Remove sub-menu items

Use remove_submenu_page($parent_slug, $submenu_slug) for finer control.

add_action('admin_menu', function () {
    remove_submenu_page('themes.php', 'theme-editor.php');   // Appearance > Editor
    remove_submenu_page('options-general.php', 'options-writing.php');
}, 999);

Tidy the admin bar too

add_action('wp_before_admin_bar_render', function () {
    global $wp_admin_bar;
    $wp_admin_bar->remove_node('wp-logo');
    $wp_admin_bar->remove_node('comments');
});
Good practice: gate removals by capability (e.g. if (!current_user_can('manage_options'))) so admins keep full access while editors get a simplified screen.