Remove specific Admin menu items in WordPress

For lots of the websites I do the clients want to use WordPress more as a CMS rather than a blogging system. In order to make this work easier for them, I usually remove the “Posts” menu item as it is not needed.

To remove the menu item, simply add the following code to the functions.php file in your active theme.

If you want to remove more items, add them to the $restricted array.



function admin_remove_items() {
                global $menu;
                $restricted = array(__('Posts'));
                end ($menu);
                while (prev($menu)){
                        $value = explode(' ',$menu[key($menu)][0]);
                        if(in_array($value[0] != NULL?$value[0]:"" , $restricted)) {
add_action('admin_menu', 'admin_remove_items');