Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to hide certain menus like Media, Privacy, and Permalinks. I've been using the following code to hide entire parent menus but not sure how to go about for submenus.

function remove_menus () {
global $menu;
        $restricted = array(__('Links'), __('Comments'), __('Appearance'), __('Tools'));
        end ($menu);
        while (prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
        }
}
add_action('admin_menu', 'remove_menus');
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

If you would like to code it yourself, here is a good tutorial for customizing the Admin Menu. http://sixrevisions.com/wordpress/how-to-customize-the-wordpress-admin-area/

Copying from the tutorial, they remove the Editor sublink:

function remove_editor_menu() {
    remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'remove_editor_menu', 1);

note: you need to know the function / action that displays it

share|improve this answer
    
Thank you. I was looking through tutorials but the one you linked had the most information. –  J82 Feb 20 '11 at 20:34
add comment

There is a plugin for that, it's called: Admin Menu Editor and you can download it here - http://wordpress.org/extend/plugins/admin-menu-editor/ it is amazing. You can show and hide sub sections of menus and whole menus in the Wordpress admin, I use it all of the time to stop clients being able to change certain things and break the site.

share|improve this answer
    
Thank you, Dwayne. That looks like an awesome plugin but I just need a quick no-plugin method for this one. I'll probably use that plugin sometime in the future. –  J82 Feb 20 '11 at 20:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.