Managing the WordPress backend sidebar can greatly improve the admin experience — especially when working with clients or teams who only need access to specific areas. Instead of relying on plugins, you can take full control of the admin menu directly through your theme’s functions.php file.
In this post, we’ll walk through ready-to-use code snippets that let you hide unwanted menu items, reorder links to match your workflow, and rename labels to suit your project. Whether you’re building a client site or just cleaning up your own dashboard, these snippets are lightweight, plugin-free, and easy to customize.
Rearranging & Show/Hide WordPress Admin Sidebar Nav Links
You can customize the WordPress admin sidebar using hooks in your theme’s functions.php file (or a custom plugin).
Remove / Hide Admin Sidebar Links
Use the admin_menu hook with remove_menu_page() and remove_submenu_page():
<?php
/**
* Remove / Hide Admin Sidebar Links
*/
add_action( 'admin_menu', 'hide_admin_sidebar_links', 999 );
function hide_admin_sidebar_links() {
// Hide top-level menu items
remove_menu_page( 'index.php' ); // Dashboard
remove_menu_page( 'edit.php' ); // Posts
remove_menu_page( 'upload.php' ); // Media
remove_menu_page( 'edit.php?post_type=page' ); // Pages
remove_menu_page( 'edit-comments.php' ); // Comments
remove_menu_page( 'themes.php' ); // Appearance
remove_menu_page( 'plugins.php' ); // Plugins
remove_menu_page( 'users.php' ); // Users
remove_menu_page( 'tools.php' ); // Tools
remove_menu_page( 'options-general.php' ); // Settings
remove_menu_page( 'woocommerce' ); // WooCommerce (if installed)
// Hide submenu items
remove_submenu_page( 'themes.php', 'widgets.php' ); // Widgets
remove_submenu_page( 'themes.php', 'nav-menus.php' ); // Menus
remove_submenu_page( 'options-general.php', 'options-reading.php' ); // Reading Settings
}
/**
* Hide only for non-admins
*/
add_action( 'admin_menu', 'hide_links_for_non_admins', 999 );
function hide_links_for_non_admins() {
if ( ! current_user_can( 'manage_options' ) ) {
remove_menu_page( 'plugins.php' );
remove_menu_page( 'tools.php' );
remove_menu_page( 'options-general.php' );
}
}
?>Reorder / Rearrange Admin Sidebar Links
Use the menu_order filter along with custom_menu_order:
<?php
// Step 1: Enable custom menu order
add_filter( 'custom_menu_order', '__return_true' );
// Step 2: Define your custom order
add_filter( 'menu_order', 'custom_admin_menu_order' );
function custom_admin_menu_order( $menu_order ) {
return array(
'index.php', // Dashboard (first)
'edit.php?post_type=page', // Pages
'edit.php', // Posts
'upload.php', // Media
'edit-comments.php', // Comments
'separator1', // -- Separator --
'themes.php', // Appearance
'plugins.php', // Plugins
'users.php', // Users
'options-general.php', // Settings
'tools.php', // Tools
'separator-last', // -- Last Separator --
);
}
?>Rename Admin Sidebar Links
<?php
/**
* Rename Admin Sidebar Links
**/
add_action( 'admin_menu', 'rename_admin_sidebar_links', 999 );
function rename_admin_sidebar_links() {
global $menu, $submenu;
// Rename top-level items
// $menu[5][0] = 'Articles'; // Rename "Posts" → "Articles"
// $menu[20][0] = 'Files'; // Rename "Pages" → "Files"
// Better approach using array search
foreach ( $menu as $key => $item ) {
if ( $item[2] === 'edit.php' ) {
$menu[$key][0] = 'Articles'; // Rename Posts
}
if ( $item[2] === 'edit.php?post_type=page' ) {
$menu[$key][0] = 'Web Pages'; // Rename Pages
}
}
// Rename submenu items
if ( isset( $submenu['options-general.php'] ) ) {
foreach ( $submenu['options-general.php'] as $key => $item ) {
if ( $item[2] === 'options-general.php' ) {
$submenu['options-general.php'][$key][0] = 'General Config';
}
}
}
}
?>Common Menu Slugs & Their Default Positions
| Position | Menu Item | Slug |
|---|---|---|
2 | Dashboard | index.php |
5 | Posts | edit.php |
10 | Media | upload.php |
15 | Links | link-manager.php |
20 | Pages | edit.php?post_type=page |
25 | Comments | edit-comments.php |
60 | Appearance | themes.php |
65 | Plugins | plugins.php |
70 | Users | users.php |
75 | Tools | tools.php |
80 | Settings | options-general.php |
Need this done on a live site? Exivon Tech takes on projects and audits, led by me.



