Remove admin menu's from Wordpress Dashboard

10 replies
  • WEB DESIGN
  • |
Hey,

I've been searching for this for a while and have finally found out how to do it.

I wanted to remove the different admin menus that many wordpress roles are able to see such as 'comments', 'dashboard', 'links' and so on.

Here's some PHP you can put in your theme's functions.php file to remove them!

You can edit the $restricted array to include/exclude the different aspects of the menu. (I.E. remove '__('Comments'),' from below in order to have them be shown in the backend.


/*-------------------------------------------------------------------------------
Remove Dashboard Menu Items
-------------------------------------------------------------------------------*/
function remove_menus()
{
global $menu;
global $current_user;
get_currentuserinfo();

if($current_user->user_login == 'username')
{
$restricted = array(__('Posts'),
__('Media'),
__('Links'),
__('Pages'),
__('Comments'),
__('Appearance'),
__('Plugins'),
__('Users'),
__('Tools'),
__('Settings')
);
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}// end while

}// end if
}
add_action('admin_menu', 'remove_menus');



All credit goes to:

http://www.elliotcondon.com/wordpres...-in-wordpress/

Advanced Power Tips for WordPress Template Developers: Reloaded - Smashing Magazine


Hope it can help someone
#admin #dashboard #menu #remove #wordpress
  • Profile picture of the author wariorart
    Thanks for share this is working for me
    {{ DiscussionBoard.errors[3737487].message }}
  • Profile picture of the author joetann
    No problem

    I forgot to add this awesome plugin as well, though it doesn't disable the admin menus, it does allow you to hide them from any and all wordpress roles. It is excellent!

    WordPress › Adminimize « WordPress Plugins


    BTW a good time to use the script given in the OP is to enter your client's username in the field given so he can't mess things up in the back end.
    Signature

    https://www.letscommence.com/ - better logo design briefs for designers
    {{ DiscussionBoard.errors[3737538].message }}
    • Profile picture of the author jamesg3
      um, i hate to tell you this, but if you look in your dashboard and click on users and go to your profile, there are 2 check boxes, one says hide admin bar on site and the other says hide admin bar in the dashboard, just check or un-check them. That all you have to do.
      Signature
      Serious Wordpress sites, html/css sites and flash sites Cheap. I provide killer SEO, easy to use e-commerce solutions and payment gateways. Check me out at Serious Website Design.
      Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.
      {{ DiscussionBoard.errors[3741512].message }}
      • Profile picture of the author jamesg3
        Oh shoot, my bad, I thought you were referring to the new admin bars that came with 3.1, sorry its early and my brain is not at full capacity yet, Sorry.
        Signature
        Serious Wordpress sites, html/css sites and flash sites Cheap. I provide killer SEO, easy to use e-commerce solutions and payment gateways. Check me out at Serious Website Design.
        Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.
        {{ DiscussionBoard.errors[3741523].message }}
  • Profile picture of the author KathyK
    I forgot to add this awesome plugin as well, though it doesn't disable the admin menus, it does allow you to hide them from any and all wordpress roles. It is excellent!

    WordPress › Adminimize « WordPress Plugins

    I really like adminimize - it's great if you are setting up WP for a client who's not exactly computer-savvy but is eager to change everything...

    Saves a lot of 'emergency' "My site doesn't work anymore - fix it!" calls. :rolleyes:

    I don't think I'd use the remove option though, unless they were REALLY dangerous...
    Signature

    Cheers,
    Kathy

    {{ DiscussionBoard.errors[3745919].message }}
  • Profile picture of the author SEK
    Thanks I have been lookin for the same info
    {{ DiscussionBoard.errors[3752525].message }}
  • Profile picture of the author VegasGreg
    Signature

    Greg Schueler - Wordpress Fanatic... Living The Offline Marketing Dream...

    {{ DiscussionBoard.errors[3754163].message }}
  • Profile picture of the author khurram_007
    Thanks dear i was looking this.
    Signature

    Get information about car problems and start work at home and earn.

    {{ DiscussionBoard.errors[3754216].message }}
  • Profile picture of the author joetann
    Good stuff

    White label plugin looks great, I am yet to use it though! Cheers
    Signature

    https://www.letscommence.com/ - better logo design briefs for designers
    {{ DiscussionBoard.errors[3755866].message }}
  • Profile picture of the author rickbauer
    For those who still looking for a good solution, take a look at Hide Admin Menu:

    This is the plugin URL:

    codecanyon.net/item/wordpress-hide-admin-menu-plugin/290744

    It's similar to Adminimize plugin but does the job better:

    - It can hide menus for admin as well (Adminimize can't)
    - It can hide menus in the admin bar (it's useless if you just hide the left menus, but forget the top ones)

    I'm using this plugin and really love it.
    {{ DiscussionBoard.errors[7159756].message }}

Trending Topics