Note : We haven’t tested this on latest WordPress themes. So proceed at your own risk.
While the WordPress administrator dashboard provides many useful features for helping you build your blog or other website, few people will find that they require all of them. Particularly if you install a lot of plugins, your dashboard sidebar will quickly end up getting severely cluttered, and this can slow down the interface and decrease your productivity. Fortunately, it is possible in newer versions of WordPress to remove certain menu items which you have no use for by adding a few lines of code to your theme functions file. For example, if your website is a static one rather than a conventional blog, you’ll probably never use the Posts or Comments sections, so why not remove them? This guide shows you how to remove the tabs you don’t need without having to install any further plugins.
- Log in to your WordPress administrator dashboard and navigate to Appearance > Edit. Open the funcitons.php file underneath Theme Functions in the sidebar to the right.
- Scroll down the page of code and paste the following lines of code into the file:
<?php
function remove_menus(){
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
}
add_action( ‘admin_menu’, ‘remove_menus’ );
?>
- Edit the above code to customize which items appear and which ones don’t on your administrator dashboard. To do this, simply remove the lines of code referring to the menu pages you want to keep. Using all of the above code will remove all of the default tabs from the sidebar, which you probably don’t want.
- If you want to remove submenus from specific tabs, you can do so by using the remove_submenu_page command instead of the remove_menu_page command. For example, if you want to hide the Themes section of the Appearance tab, you can use the following line of code:
Remove_submenu_page( ‘themes.php’ );
- Save your changes by clicking “Update File” at the bottom of the page. If you change your theme, you will need to edit the functions.php file again, since this code is specific to the currently activated theme rather than the WordPress platform itself.