After we developed our client’s website, we need to remove some of navigation menus in WordPress administration panel.

Hiding settings and other unusable menus from client is a good practice because you are avoiding unusual changes in settings which would cause improper behavior to the website.

How to do it?

There are plenty of plugins out there that you can grab and will take care everything for you. However, if you don’t want to populate your website with plugin, we have a code for you.

Just copy the code below into your theme’s functions.php and uncomment the menus that you want to hide.

add_action( 'admin_menu', 'ywt_remove_admin_menus' );
function ywt_remove_admin_menus(){

    //remove_menu_page( 'index.php' );                  //Hide Dashboard Menu
    //remove_menu_page( 'edit.php' );                   //Hide Posts Menu
    //remove_menu_page( 'upload.php' );                 //Hide Media Menu
    //remove_menu_page( 'edit.php?post_type=page' );    //Hide Pages Menu
    //remove_menu_page( 'edit-comments.php' );          //Hide Comments Menu
    ///remove_menu_page( 'themes.php' );                 //Hide Appearance Menu
    //remove_menu_page( 'plugins.php' );                //Hide Plugins Menu
    //remove_menu_page( 'users.php' );                  //Hide Users Menu
    //remove_menu_page( 'tools.php' );                  //Hide Tools Menu
    //remove_menu_page( 'options-general.php' );        //Hide Settings Menu